From 2cf9a172dd3f18a92ce2293b95d554ffca28f51d Mon Sep 17 00:00:00 2001 From: RealStickman Date: Sun, 13 Sep 2020 19:17:41 +0200 Subject: [PATCH] Added stuff for servers --- .../Server-setups/debian-fixterminal.md | 10 ++ .../Server-setups/debian-nextcloud.md | 101 ++++++++++++++++++ .../Dokumente/Server-setups/debian-ssh.md | 45 ++++++++ 3 files changed, 156 insertions(+) create mode 100644 arch-config/Dokumente/Server-setups/debian-fixterminal.md create mode 100644 arch-config/Dokumente/Server-setups/debian-nextcloud.md create mode 100644 arch-config/Dokumente/Server-setups/debian-ssh.md diff --git a/arch-config/Dokumente/Server-setups/debian-fixterminal.md b/arch-config/Dokumente/Server-setups/debian-fixterminal.md new file mode 100644 index 00000000..2e1225ba --- /dev/null +++ b/arch-config/Dokumente/Server-setups/debian-fixterminal.md @@ -0,0 +1,10 @@ +# Fix the terminal + +*All commands assume being logged in as root user on the server unless noted otherwise.* + +Appends the fix for termite to the .bashrc file. (run from home directory) +```bash +echo 'export TERM=xterm-color' >> .bashrc +``` + + diff --git a/arch-config/Dokumente/Server-setups/debian-nextcloud.md b/arch-config/Dokumente/Server-setups/debian-nextcloud.md new file mode 100644 index 00000000..dc9b3b0b --- /dev/null +++ b/arch-config/Dokumente/Server-setups/debian-nextcloud.md @@ -0,0 +1,101 @@ +# Nextcloud installation + +*All commands assume being logged in as root user on the server unless noted otherwise.* + +Installing required packages +```bash +apt install mlocate apache2 libapache2-mod-php mariadb-client mariadb-server wget unzip bzip2 curl php php-common php-curl php-gd php-mbstring php-mysql php-xml php-zip php-intl php-apcu php-redis php-http-request +``` + +## Set up the database +Just press enter when asked for a root password this time, as it has not yet been set. +```bash +mysql -u root -p +``` + +The command prompt should have changed to something similar to `MariaDB [(none)]>` + +```mysql +CREATE DATABASE nextcloud; +``` + +```mysql +GRANT ALL ON nextcloud.* TO 'nextcloud'@'localhost' IDENTIFIED BY ''; +``` + +```mysql +FLUSH PRIVILEGES; +``` + +Exit the MariaDB prompt. +```mysql +\q +``` + +## Nextcloud installation + +Change into the /var/www directory. + +Download the latest Nextcloud version (19.0.2 at the time of writing). +```bash +wget https://download.nextcloud.com/server/releases/nextcloud-.zip +``` + +Unzip Nextcloud +```bash +unzip nextcloud- +``` + +Change owner and group of the nextcloud directory. +```bash +chown -Rfv www-data:www-data nextcloud +``` + +Create the apache2 site configuration for Nextcloud. +```bash +vi /etc/apache2/sites-available/nextcloud.conf +``` + +Copy this configuration into the newly created file. + +``` + +ServerAdmin webmaster@localhost +DocumentRoot /var/www/nextcloud +Alias /nextcloud "/var/www/nextcloud/" + + +Options +FollowSymlinks +AllowOverride All + + +Dav off + + +Require all granted + +SetEnv HOME /var/www/nextcloud +SetEnv HTTP_HOME /var/www/nextcloud + + +ErrorLog ${APACHE_LOG_DIR}/nextcloud_error_log +CustomLog ${APACHE_LOG_DIR}/nextcloud_access_log common + +``` + +Enable the nextcloud config and disable the default config. +```bash +a2ensite nextcloud.conf && a2dissite 000-default.conf +``` +```bash +systemctl restart apache2 && systemctl status apache2 +``` + +Final configuration has to be done in the Nextcloud webinterface. + +## HTTPS setup + + + + + diff --git a/arch-config/Dokumente/Server-setups/debian-ssh.md b/arch-config/Dokumente/Server-setups/debian-ssh.md new file mode 100644 index 00000000..d21d91fc --- /dev/null +++ b/arch-config/Dokumente/Server-setups/debian-ssh.md @@ -0,0 +1,45 @@ +# ssh + +*All commands assume being logged in as root user on the server unless noted otherwise.* + +```bash +apt install openssh-server +``` + +```bash +systemctl enable ssh +``` + +Permit root login (will be restricted again later). +```bash +vi /etc/ssh/sshd_config +``` +Find `PermitRootLogin without-password` and change it to `PermitRootLogin yes`. Remove the `#` in front of it if there is one. +```bash +systemctl restart ssh +``` + +## Add ssh-keys + +*This command has to be run from the computer you want to have ssh access through keys later.* +```bash +ssh-copy-id -i @ +``` +In the location of the ssh public keys has to be inserted. The default is ~/.ssh/id_rsa.pub. +In case you have not yet created an ssh-key, run the following command. +```bash +ssh-keygen +``` + +## Disable password access + +```bash +vi /etc/ssh/sshd_config +``` +Find `PasswordAuthentication yes` and change it to `PasswordAuthentication no`. Remove the `#` in front of it if there is one. +```bash +systemctl restart ssh +``` + + +