2022-05-08 15:29:45 +00:00
|
|
|
= 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
|
2022-05-17 09:58:19 +00:00
|
|
|
apt install sudo python3 git -y
|
2022-05-08 15:29:45 +00:00
|
|
|
|
|
|
|
# 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
|
|
|
|
----
|
|
|
|
|
2022-05-17 09:58:19 +00:00
|
|
|
Clone the repository with `git clone` into `/home/admin/advlabdb`. Then `cd` into the new cloned repository:
|
|
|
|
|
|
|
|
[source,bash]
|
|
|
|
----
|
|
|
|
cd ~/advlabdb
|
|
|
|
----
|
|
|
|
|
|
|
|
Change server_name in `advlabdb/scripts/setup/advlabdb.conf` to your SERVER_NAME.
|
|
|
|
|
2022-05-08 15:29:45 +00:00
|
|
|
Run the following:
|
|
|
|
|
|
|
|
[source,bash]
|
|
|
|
----
|
|
|
|
# Run server setup script
|
2022-05-08 19:26:25 +00:00
|
|
|
cd ~/advlabdb
|
2022-05-17 09:58:19 +00:00
|
|
|
python3 advlabdb/scripts/setup/server_setup.py
|
2022-05-08 15:29:45 +00:00
|
|
|
----
|
|
|
|
|
2022-05-17 09:58:19 +00:00
|
|
|
[source,bash]
|
|
|
|
----
|
|
|
|
python3 -m advlabdb.scripts.setup.init_database
|
|
|
|
----
|
2022-05-08 15:29:45 +00:00
|
|
|
|
|
|
|
== 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`
|