1
0
Fork 0
mirror of https://codeberg.org/Mo8it/AdvLabDB.git synced 2024-09-19 18:31:16 +00:00
AdvLabDB/docs/user_docs/server_setup.adoc
2022-05-17 13:10:36 +02:00

100 lines
1.5 KiB
Text

= Server setup
== Setup scripts
`ssh` as `root`:
[source,bash]
----
ssh root@SERVER_NAME
----
Run the following (as root):
[source,bash]
----
# Install needed packages
apt update
apt install sudo python3 git -y
# Add a sudo user with the name 'admin'
sudo useradd admin
sudo usermod -aG sudo admin
sudo mkhomedir_helper admin
# Enter a new password for 'admin'
sudo passwd admin
# Break the SSH connection
exit
----
`ssh` again with the new user `admin` and password:
[source,bash]
----
ssh admin@SERVER_NAME
----
Clone the repository with `git clone` into `/home/admin/advlabdb`. Then `cd` into the new cloned repository:
[source,bash]
----
cd ~/advlabdb
----
[source,bash]
----
cp advlabdb/scripts/setup/advlabdb.conf.template advlabdb/scripts/setup/advlabdb.conf
----
Change `server_name` in `advlabdb/scripts/setup/advlabdb.conf` to your SERVER_NAME.
[source,bash]
----
cp .env.template .env
----
Generate secrets for `.env`:
[source,bash]
----
python3 advlabdb/scripts/setup/generate_secrets.py
----
Fill the secrets generated using the last script into `.env`.
Enter your SERVER_NAME in `.env`.
Run the following:
[source,bash]
----
# Run server setup script
python3 advlabdb/scripts/setup/server_setup.py
----
After reboot:
[source,bash]
----
poetry run python3 -m advlabdb.scripts.setup.init_database
----
== Stop ssh to root
// TODO: Add blocking password access
IMPORTANT: This step is important for security!
Change
----
PermitRootLogin yes
----
to
----
PermitRootLogin no
----
in the config file `/etc/ssh/sshd_config`