setup-config-debian-bullseye
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/
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
Odds and Ends
apt-get install screen dpkg-reconfigure tzdata
Website Updates
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
#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
PHP Fatal error: Uncaught Error: Call to undefined function mysql_connect()
Edit php script and change mysql_connect() to mysqli_connect()
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
setup-config-debian-bullseye.1658356743.txt.gz · Last modified: 2022/07/20 22:39 by admin