This is an old revision of the document!
−Table of Contents
This page outlines some of the noteworthy points on setting up Debian Bullseye on a hetzner Cloud server.
Apache Setup
apt-get install apache2 apt-get install libapache2-mod-php apt-get install default-mysql-server (mariadb is now default) mysql_secure_installation ( https://tecadmin.net/how-to-install-mariadb-on-debian-11/ ) apt-get install php-mysql a2enmod userdir vi /etc/apache2/mods-enabled/php7.4.conf comment out lines to enable php for userdirs adduser kartbuilding cd /home/kartbuilding/ mkdir public_html vi index.php <?php phpinfo(); ?>
That should be the basic lamp setup.
Virtual Hosts
vi /etc/apache2/sites-available/01-kartbuilding.conf <VirtualHost *:80> ServerAdmin email@domain.net ServerName www.kartbuilding.net ServerAlias kartbuilding.net DocumentRoot /home/kartbuilding/public_html/ CustomLog /var/log/apache2/access_kart.log combined ErrorLog /var/log/apache2/error_kart.log Loglevel warn <Directory /> Options FollowSymLinks Indexes MultiViews AllowOverride All </Directory> UserDir disabled </VirtualHost> #Repeat block for other vhosts on this domain <code> #Enable site with a2ensite 01-kartbuilding #or symlink into /etc/apache2/sites-enabled
MySQL migrations
- mysqldump on original host as per: mysqldump
- Add new user as per: mysql_users_add_remove
- login to mysql and go “create database”
- Import mysql dump importing_a_mysql_dump
Copy across data to new server
#always source -> destination #On new server issue rsync -ave ssh user@oldserver:/home/kartbuilding/ /home/kartbuilding/
Odds and Ends
apt-get install screen dpkg-reconfigure tzdata
VIM tweaks
Because vi rocks
apt-get install vim vi /etc/vim/vimrc uncomment syntax on uncomment let g:skip_defaults_vim = 1 (allows default vim control mouse off) https://unix.stackexchange.com/questions/551512/disabling-vim-visual-mode-in-etc-vim-vimrc-does-not-work
Website Updates
Wordpress
I had wordpress done via SVN, so it was easy. cd /home/kartbuilding/public_blog svn info svn sw http://core.svn.wordpress.org/tags/6.0.1/ .
php5 -> php7 woes
Where possible any webapps will have to be updated as there are a lot of changes between php5 and php7.
#Apache error log showed: PHP Parse error: syntax error, unexpected 'new' (T_NEW) in...... on line 35 Edit the php file and on line 35: Remove the &. Its not needed in php7. Example: Original php5 $bbdb =& new $bbdb_class( array( New: $bbdb = new $bbdb_class( array(
mysql woes
Where possible any webapps will have to be updated as there are a lot of changes between php5 and php7.
PHP Fatal error: Uncaught Error: Call to undefined function mysql_connect()
Edit php script and change mysql_connect() to mysqli_connect()
Wiki
Mediawiki instance was so old. Tried to copy it and update php scripts to php7. No joy, had problems connecting to database. The latest mediawiki was nearly 300MB (previous was 60MB).
I made the decision to install and migrate to dokuwiki which doesn't use sql but flat text files.
dokuwiki
Install was very straight forward. (Info at: https://www.dokuwiki.org/install ) However for migration purposes, I chose to install an older version of dokuwiki for my php5.
Went for an old stable release at: https://download.dokuwiki.org/archive If its too new, you'll get errors when running with php5.
chmod 777 and run install.php
Migration of mediawiki
Setup and have dokuwiki installed with new install and user.
https://www.dokuwiki.org/tips:mediawiki_to_dokuwiki_converter For old Media wiki. https://github.com/tetsuo13/MediaWiki-to-DokuWiki-Importer/archive/99b29b645fb7f5bb8c5c03b23d1bfbb4eee642ed.zip Download and extract Zip. Browse to and edit: public_html/mediatodoc/src/MediaWiki2DokuWiki/settings.php Update paths. Run via browser /mediatodoc/src/MediaWiki2DokuWiki/index.php (got an error the first time, and had to add: $wgDBtype = "mysql"; to LocalSettings. Explore to dokuwiki, go to Site Map and all pages should be listed. Copy folder to newserver. Upgraded as per dokuwiki info ( https://www.dokuwiki.org/install:upgrade )
Swap File for VM
Hetzner cloud server did not come with swap space. While you could console and resize, creating a swap file was a nice quick solution.
Check for swap
root@sun:~# free total used free shared buff/cache available Mem: 1981092 180740 250956 15668 1549396 1596964 Swap: 0 0 0 cat /etc/fstab #shows no swap
Create swap file
fallocate -l 2G /swapfile chmod 600 /swapfile mkswap /swapfile swapon /swapfile root@sun:~# free total used free shared buff/cache available Mem: 1981092 182696 245032 15668 1553364 1594984 Swap: 2097148 0 2097148
Add to fstab for reboot
vi /etc/fstab #add /swapfile swap swap defaults 0 0 swapon --show
Delete Swap file
swapoff -v /swapfile edit fstab rm the file
Mail Server Setup
Followed postfix_smtp which was mostly OK and still accurate (updated portions of this page at same time for debian bullseye. )
Also followed courier_imaps_server_-_maildir again, mostly which was OK (updated this wiki page at the same time for debian bullseye.)
See final Postfix config → debian_bullseye_config
Secure smtpd using Postfix and sasl
Debian bullseye had a lot set by default and changed a lot since secure_outgoing_smtp_via_postfix_courier_tls_and_sasl
Step 1 - follow: http://wiki.debian.org/PostfixAndSASL Step 2 - http://blog.bekyarov.info/2013/01/04/testsaslauthd-connect-no-such-file-or-directory-0-postfix-postfixsmtpd11571-warning-sasl-authentication-failure-cannot-connect-to-saslauthd-server-no-such-file-or-directory/ Step 3 - https://doc.axrglobal.com/servidores:mail:mail_system