Met dit Linux bash-script zet je heel snel een webserver op.
Maak eerst een VM aan of nog beter: draai eerst het Proxmox script om een Ubuntu container aan te maken.
Log in op de Ubuntu LXC.
Type nano inst.sh en copy-paste alle tekst hieronder daar in:
Maak inst.sh startbaar met chmod +x inst.sh en draai het script met /inst.sh
Wel moet je nog wel apache2 aanvinken, een wachtwoord voor mysql invoeren, en de gegevens voor de ftp-user invullen.
OPMERKING: FTP toegang werkt nu out-of-the-box, zonder aanpassingen aan de configuratie!!!!
#!/bin/bash
sudo apt-get update && sudo apt upgrade -y
# Controleer welke services draaien
sudo service --status-all
# Zet ssh service aan:
sudo systemctl start ssh
sudo systemctl enable ssh
# Installeer de volgende pakketten:
sudo apt-get install -y mc unzip vsftpd apache2* php libapache2-mod-php mariadb-server phpmyadmin php-cli php-common php-mbstring php-gd php-intl php-xml php-mysql php-zip php-curl php-xmlrpc php-curl mariadb-server phpmyadmin
# Activeer de SFTP-service
sudo service vsftpd start
sudo systemctl enable vsftpd
# Even een kopie van de configuratie maken, voordat je die eventueel aanpast
cp /etc/vsftpd.conf /etc/vsftpd.conf.org
# Pas de firewall aan:
sudo ufw allow from any to any port 80,443,20,21,22,3306,10000:10100 proto tcp
sudo ufw allow OpenSSH
sudo ufw enable
sudo ufw status
# Maak een FTP gebruiker aan:
sudo adduser marcel
echo "marcel" | sudo tee -a /etc/vsftpd.user_list
sudo mkdir -p /home/marcel/ftp/upload
sudo chmod 550 /home/marcel/ftp
sudo chmod 750 /home/marcel/ftp/upload
sudo chown -R marcel: /home/marcel/ftp
# Herstart de vsftpd service
# sudo systemctl restart vsftpd
sudo systemctl start vsftpd.service
sudo systemctl enable vsftpd.service
# Controleer dat de nieuwe service draait
sudo systemctl status vsftpd.service
echo "Controleer op de VM dat je kunt inloggen met ftp als marcel:"
echo "ftp localhost"
ftp localhost
# Gek genoeg kun je nu niet als root met PuTTy inloggen, maar wel als 'marcel'.
# Dit kun je oplossen door 'marcel' lid te maken van sudoers:
sudo usermod -aG sudo marcel