Log inRegister
You are here: Boossy » WebDesign » WdWebsites » StratoVpsLinux

Strato VPS Linux

  • € 5 / maand
  • 1 CPU vCore
  • 2 GB RAM
  • 50 GS SSD
  • 100 Mbit/s
  • ∞ dataverkeer

OS

VPS Ubuntu 20.04 LTS 64bit / Debian 9 64bit

Locale

echo $LANG

Na installatie staat alles standaard op nl_NL.utf8.

Workaround

In /root/.bashrc aangepast, volgende toegevoegd op het einde:
export LANG=en_US.UTF-8
export LANGUAGE=en_EN.UTF-8
export LC_ALL=en_US.UTF-8

LANGUAGE en LC_ALL mogen van mij eigenlijk 'leeg' zijn.

source: https://gathering.tweakers.net/forum/list_messages/2115670

Solution

Achteraf ontdekte ik dat Ubuntu 'normaal' kijkt naar /etc/default/locale. Maar die zag er netjes als volgt uit:
LANG=en_US.UTF-8

Althans, in Ubuntu.

In Debian stond die op nl_NL.UTF-8. Dus daar moest ik die wel op en_US.UTF-8 instellen.

Een blik op /etc/environment en /etc/profile zorgde ervoor dat ik vaststelde dat de drie variabelen werden gezet in /etc/profile. Dus daar heb ik ze gewoon uitgemarkeerd (#), en uiteraard heb ik ze ook weggehaald uit /root/.bashrc.

En vervolgens heb ik de taalbestanden opnieuw gegenereerd nadat ik nl_NL.utf8 had weggehaald uit /etc/locale.gen.

root@stratoserver:~# locale-gen --purge
Generating locales (this might take a while)...
 en_US.UTF-8... done
Generation complete.

De optie --purge verwijdert bestaande locales vooraleer de nieuwe/andere worden gegenereerd.

Zie: Voor Debian:

Private & Public key (om zonder wachtwoord te kunnen inloggen)

Zie: https://www.configserverfirewall.com/windows-10/putty-server-refused-our-key/
  • genereer met de PuTTY Key Generator (keygen) een public & een private key en sla de private key op
  • laad in !PuTTY de gewenste configuratie
  • Ga dan in de linkerkolom (Category) naar Connection > SSH > Auth
  • Browse… dan in het panel 'Authentication parameters' naar de gegenereerde private key
  • Op de server zelf heb je per user een public key nodig - voor root plaats je die in /root/.ssh/authorized_keys

Admin user

Voor je ook maar iets installeert of doet, maak gewoon een andere user aan waarmee je dan werkt.

Zie: How to Create a Sudo User on Debian {3 Easy Steps} (phoenixnap.com)

Add the new user

adduser admin

Add user to the sudo group

usermod -aG sudo admin

-a(dd to )G(roup)

Check that the new user was added to the sudo group:

getent group sudo

get ent(ries from administrative database file …)

Verify the new user has sudo access

su - admin

Setup

Java

OK

MySQL

zie: https://ubuntu.com/server/docs/databases-mysql

Installatie

sudo apt install mysql-server

Status

sudo service mysql status

Netwerkstatus

sudo ss -tap | grep mysql

Set root password

Zorg ervoor dat je 'sudo' gebruikt, of je krijgt geen toegang:

ERROR 1698 (28000): Access denied for user 'root'@'localhost'

sudo mysql -u root --skip-password

Log in after root password creation

Zorg ervoor dat je 'sudo' gebruikt, of je krijgt geen toegang!

sudo mysql -u root -p

Access your server db on your Windows client using e.g. MySQL Workbench:

  • revert to !MySQL native password authentication¹:
    • log into mysql
    • issue the following command:
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'your_password';
  • define a tunnel in your !PuTTY session:
    • load the session
    • go to category Connection > SSH > Tunnels
    • in the Port forwarding pane, Add new forwarded port:
      • Source port: ####
      • Destination: localhost:3306
      • then press the Add button
    • now return to category Session and press the Save button to preserve your changes
  • now launch the !MySQL Workbench and click the + icon to setup a new connection:
    • enter the Connection Name
    • normally, in the Parameters tab, just change the Port to the port number you've used in your PuTTY connections settings above (####)
    • then click the Test Connection button
¹Source: https://askubuntu.com/questions/773446/unable-to-connect-via-mysql-workbench-to-localhost-in-ubuntu-16-04-passwordless

¹Achteraf toch weer gewijzigd naar caching_sha2_password, en bleef werken in MySQL Workbench, maar toch ook een tweede user met identieke rechten gemaakt.

WildFly

v1 on Ubuntu

  • /etc/default/wildfly-env
  • /etc/init.d/wildfly-env
+ autostart:
  • sudo update-rc.d wildfly-env defaults

v2 on Debian

See: https://linuxhostsupport.com/blog/how-to-install-wildfly-14-on-debian-9/

/etc/default/wildfly

Contrary to the description, use your server IP instead of 0.0.0.0

Line endings

Make sure the line endings of your Linux scripts are not DOS, but Linux/Unix like. If necessary, correct them in vi by issuing the following command:

:set fileformat=unix

Source: https://stackoverflow.com/questions/2920416/configure-bin-shm-bad-interpreter

Files concerned:
  • vi /etc/default/wildfly
  • vi /opt/wildfly/bin/launch.sh
  • vi /etc/systemd/system/wildfly.service
  • vi /etc/apache2/sites-available/your-domain.conf

java.lang.OutOfMemoryError

Adjust memory settings in /opt/wildfly/bin/standalone.conf
# JAVA_OPTS="-Xms64m -Xmx512m -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true"
 JAVA_OPTS="-Xms384m -Xmx512m -XX:MetaspaceSize=128M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true"

So both the values for -Xms and -XX:MetaspaceSize must be larger.

ulimit -a?
core file size (blocks, -c) 0
...
max locked memory (kbytes, -l) 64
...

Op server101 is dat unlimited en 16384 resp.
ulimit -c unlimited
ulimit -l 16384

Maar eigenlijk niet nodig, blijkt achteraf

/opt/wildfly/standalone/configuration/logging.properties

File in gebruik ziet er totaal anders uit dan in de distributie, nochtans geen handmatige wijzigingen gedaan, maar:

# Note this file has been generated and will be overwritten if a
# logging subsystem has been defined in the XML configuration.

/opt/wildfly/standalone/configuration/standalone.xml: bind addresses

Alle bind addresses staan standaard op 127.0.0.1.

Wijzig dat in het publieke IP-adres van je server:

...
<wsdl-host>${jboss.bind.address:123.4.5.6}</wsdl-host>
...
<inet-address value="${jboss.bind.address.management:123.4.5.6}"/>
...
<inet-address value="${jboss.bind.address:123.4.5.6}"/>
...

Launch: manually and/or as a service

Manually
/opt/wildfly/bin/launch.sh standalone standalone.xml 12.345.678.901

If everything goes fine, the startup ends with something like:
11:14:36,061 INFO [org.jboss.ws.common.management] (MSC service thread 1-1) JBWS022052: Starting JBossWS 5.1.5.Final (Apache CXF 3.1.6)
11:14:36,262 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://12.345.678.901:9990/management
11:14:36,275 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://12.345.678.901:9990
11:14:36,276 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 10.1.0.Final (WildFly Core 2.2.0.Final) started in 5262ms - Started 331 of 577 services (393 services are lazy, passive or on-demand)
As a service

three commands: start, stop, status
systemctl start wildfly
systemctl status wildfly

● wildfly.service - The WildFly Application Server
Loaded: loaded (/etc/systemd/system/wildfly.service; disabled; vendor preset: enabled)
Active: active (running) since Tue 2022-03-29 11:18:04 CEST; 4s ago
Main PID: 2824 (sh)
Tasks: 98
CGroup: /system.slice/wildfly.service
├─2824 /bin/sh /opt/wildfly/bin/launch.sh standalone standalone.xml 1.2.3.4
├─2825 /bin/sh /opt/wildfly/bin/standalone.sh -c standalone.xml -b 1.2.3.4
└─2881 java -D[Standalone] -server -Xms384m -Xmx512m -XX:MetaspaceSize=128M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -Dorg.jbo

Mar 29 11:18:04 h1234567.myserver.tld systemd[1]: Started The WildFly Application Server.
systemctl stop wildfly
DefaultTasksMax=infinity

Looking back on my changes, I noticed that the following setting also needs to be changed for WildFly to run on my system (don't know if it makes any difference for running it manually and/or as a service):

In /etc/systemd/system.conf, add the following:
DefaultTasksMax=infinity

(source: https://stackoverflow.com/questions/16789288/java-lang-outofmemoryerror-unable-to-create-new-native-thread)
Check in the browser

When the server runs, go to http://12.345.678.901:8080 to verify if you get the "Welcome to WildFly 10" page.
Apache + mod_jk

Installatie

sudo apt install apache2

Als het goed is, is je server nu in een browser als site bereikbaar over zijn ip-adres:

http://12.345.678.90/

/etc/systemd/journald.conf:
Storage=persistent

Nodig?

Configuratie

1) Modules
apachectl -M

toont welke modules al actief zijn.

Dan is het een kwestie van de resterende in te schakelen (a2enmod), als ze niet conflicteren met andere (zoals mpm_event en mpm_worker). Dan moet je de conflicterende eerst uitschakelen (a2dismod):

sudo a2enmod authz_groupfile
sudo a2enmod cgid
sudo a2enmod expires
sudo a2enmod headers
sudo a2enmod info
sudo a2dismod mpm_event
sudo a2enmod mpm_worker
sudo a2enmod proxy
sudo a2enmod proxy_fcgi
sudo a2enmod rewrite
sudo a2enmod ssl
sudo systemctl restart apache2
2) Verdere configuratie
  • /srv/conf/serverx.conf
  • /etc/apache2/sites-available/serverx.conf → /srv/conf/serverx.conf
  • /etc/apache2/sites-enabled/serverx.conf → ../sites-available/serverx.conf
3) hosts file op client

Zolang je geen domein bestelt of verhuist, kun je je site bereiken via http://12.345.678.90/.

Wil je toch http://mijndomein.tld gebruiken, wijzig dan het bestand "C:\Windows\System32\drivers\etc\hosts" op je lokale toestel:
12.345.678.90 mijndomein.tld

sendmail

vi /opt/wildfly/bin/launch.sh

tags

Ctrl+M Ctrl M Control M ^M
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback
This page was cached on 24 Apr 2024 - 07:30.