Uncategorized

Topics that don't need a category, or don't fit into any other existing category.

Wordpress installation

- Posted in Uncategorized by

Should you for some reason need to install a Wordpress-site, here are the basics:

1) Install packages, run:

apt install libapache2-mod-php apache2 php-gd php-mysql php-zip mariadb-server -y

2) Secure MariaDB, run:

mysql_secure_installation

and go through the wizard:

<Enter> to set password if empty
N for no Unix socket
Y to change root pass
Y to remove anonymous users
Y to disallow remote root login
Y to remove test db
Y to reload privilege table

3) Create a user, a database and set permissions

Connect to MariaDB, run:

mysql -uroot -p

Create a user, run:

CREATE USER 'wordpress'@'localhost' IDENTIFIED BY 'V3RY_S3CR3T_P4SSW0RD';

Create database, run:

CREATE DATABASE wordpress;

Set permissions for database and user, run:

GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpress'@'localhost';

Apply changes, run:

FLUSH PRIVILEGES;

Exit from MariaDB, run:

quit

4) Download latest version of Wordpress

cd /var/www/html/ && wget https://wordpress.org/latest.tar.gz

5) Extract Wordpress archive

tar xzf latest.tar.gz

6) Move files from newly created "wordpress"-folder and delete it, including the default index.html from the Apache install

mv wordpress/* . && rm -rf wordpress/

7) Set permissions to Wordpress-install, if not already properly configured

chown -R www-data: /var/www/html/

Browse to the webserver and complete the installation wizard.

Valheim beta is regularly updated, this goes for both server and client. The client is usually updated automatically via Steeam, however the dedicated server is not. When the versions mismatch, ie: the server is behind; clients can no longer connect to the server.

Updating the server to the latest beta is easy, yet manual. I've written a few scripts to take care of this process. It could be improved in many ways, but it works so why bother.

Note: This procedure requires steamcmd

1) Create a start-script for Valheim, mine is called valheim.sh and is placed with the binary:

#!/bin/sh
export templdpath=$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=./linux64:$LD_LIBRARY_PATH
export SteamAppID=892970
echo "Starting server PRESS CTRL-C to exit"
./valheim_server.x86_64 -name "valheim" -port 12345 -nographics -batchmode -world "worldname>" -password "password" -public 1
export LD_LIBRARY_PATH=$templdpath

2) Start a screen named valheim by running screen -S valheim

3) Run valheim.sh to start the dedicated server and detach from the screen

4) Create a new script called valheim_nightly_update.sh with the following content:

#!/bin/bash
VALSCREEN=valheim
echo "Sending Control+C to $VALSCREEN"
screen -S $VALSCREEN -X stuff $'�03'
echo "Sleeping 10 seconds, let Valheim server shut down..."
sleep 10
echo "Sleep done"
echo "Running update check and install..."
/bin/bash /home/aners/valheim/InstallUpdate.sh
echo "Update check and install complete, sleeping 5 seconds"
sleep 5
echo "Starting Valheim-server"
screen -S valheim -X stuff 'sh /home/aners/valheim/valheim.sh'`echo -ne '�15'`

5) Create a crontab for the script with a runtime of your chosing

Mine looks like this:

# m h  dom mon dow   command
0 5 * * * /bin/bash /home/aners/valheim_nightly_update.sh

Every morning, my Valheim server is stopped, updated and restarted.

Use wget and perl to reboot a Netgear ISP provided CPE/modem/router from comandline. Replace IP-address and 'REALPASSWORD' with your own settings

id=$(wget --quiet -O- --http-user admin --http-password password http://192.168.100.1/RouterStatus.htm | perl -lne '/id=([0-9]+)/ && print $1'); wget --quiet --http-user admin --http-password REALPASSWORD --post-data 'buttonSelect=2' http://192.168.100.1/goform/RouterStatus?id="$id"