-
Notifications
You must be signed in to change notification settings - Fork 9
Technical Documentation for migrating from one SORMAS server to APMIS server
APMIS MIGRATION GUIDE.pdf Secure access to the server using public key authentication.
Create limited operating system user Note: replace test_user with desired username
- Connect to the linode server
- On your local machine, open a terminal window and enter the following to connect to the linode server. ssh [email protected]
- accept any prompts and enter the password of the root user
- on successful login, enter the following adduser test_user
- enter the required information
- add the user to sudo group so that it can have admin privileges adduser test_user sudo
Generate cryptographic key-pair for SSH authentication to the server Note: replace USERS_HOME_DIR with local machine users home directory. E.g. C:\Users\username on windows or /home/username on MacOs
- On your local machine, open a new terminal window
- Open the terminal on your local machine (This guide is using windows 10 power shell, opened as administrator) ssh-keygen -b 4096 -f USERS_HOME_DIR/.ssh/apmis_test_user -C test_user
- The ssh keypairs apmis_test_userv(private key) and apmis_test_user.pub (public key) in USERS_HOME_DIR/.ssh directory on your local machine
Upload public key to linode server
- Connect to the linode server as the new user
- On the linode server terminal window, enter exit to disconnect as root
- Connect as the new user ssh [email protected]
- Create directory to store authorized keys and required permissions mkdir -p ~/.ssh sudo chmod -R 700 ~/.ssh/
- Create the authorized_keys file nano ~/.ssh/authorized_keys
- *On your local machine, open apmis_test_user.pub (public key) in a text editor and copy the contents (in one line, no new lines)
- Paste this content into the nano editor window on the linode server. Ensure that it is on one line
- Press CTRL+x to save
- Enter Y and press enter to save the file
- Restart the SSH service sudo systemctl restart sshd
Confirm new user can login via ssh key pair
- Disconnect from the linode terminal (Enter exit)
- Connect as new user using ssh keys ssh -i USER_HOME_DIR.ssh\apmis_test_user [email protected]
- Enter the passphrase you specified while creating the key pair
- You should be successfully logged in.
Disable remote login for root user and also enable SSH key pair only (no plain text password) SSH access to the server
- Disconnect from the linode terminat
- Connect as the root user nano
- Make the following edits (uncomment them if commented (prefixed with #)) PermitRootLogin no ….. PasswordAuthentication no
- Enter CTRL+x to save
- Enter Y to save
- Restart SSH service sudo systemctl restart sshd
- Exit and try to login as root user again, you should get an error message.
- Hence to acess root user a. First login as the other user using private keys b. Then enter su – root c. Enter the root password on the server to continue
Login as root user
- Disconnect from the linode terminal (Enter exit)
- Connect as new user using ssh keys ssh -i USER_HOME_DIR.ssh\apmis_test_user [email protected]
- On successful login, enter the following to switch to the root user su – root
- Enter the root users password and the prompt should become the root user.
Backup Netzlink Server resources and transfer to new linode server
Backup the netzlink sormas database
- Connect to the netzlink server via ssh. (connect as the non root user that can connect through an FTP client for file transfer) ssh user@netzlink-ip-address
- List the available docker containers sudo docker container ls
- You should see information about the containers, note the name of the containers, especially a. sormas-docker_apache2_1 (container name for Apache server) b. sormas-docker_sormas_1 (container name for SORMAS application Payara server) c. sormas-docker_postgres_1 (container for PostgreSQL database server)
- Login to the PostgreSQL container sormas-docker_postgres_1
Install SORMAS Pre-requisite.
Login as root user
- Login to linode server as root
- Connect as new user using ssh keys ssh -i USER_HOME_DIR.ssh\apmis_test_user [email protected]
- On successful login, enter the following to switch to the root user su – root
- Enter the root user’s password and the prompt should become the root user.
Install required OS packages
- Still connected as root user on the linode server
- Install the following packages apt install acl apt install gcc apt install zip apt install unzip apt install make
Install Azul OpenJDK Java 11 runtime
- As root user. sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0xB1998361219BD9C9 sudo apt-add-repository 'deb https://repos.azul.com/zulu/deb/ stable main' sudo apt-get update sudo apt-get install zulu11
Install PostgreSQL 10 database
- As root user sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - sudo apt-get update sudo apt-get -y install postgresql-10 2. Edit postgresl config file for minimum SORMAS requirements nano /etc/postgresql/10.0/main/postgresql.conf 3. Set max_connections = 288 …. max_prepared_transactions = 256 4. Enter CTRL+x to save 5. Enter Y to save 6. Restart postgrsql server systemctl restart postgresql 7. Install required postgresql extensions sudo apt-get install libpq-dev sudo apt-get install postgresql-server-dev-10 sudo apt install pgxnclient 8. check for GCC: gcc --version # and install if missing 9. Install the temporal_tables extension sudo pgxn install temporal_tables 10. Restart postgresql server systemctl restart postgresql
Install Apache web server
- As root user. sudo apt update sudo apt install apache2
- Confirm by entering the IP address of the server in a browser, you should see the default apache web page. This will be changed and configured later.
- Enable required web server modules a2enmod ssl a2enmod rewrite a2enmod proxy a2enmod proxy_http a2enmod headers
- Restart the web server systemctl restart apache2
Install SORMAS
Login as root user
- As root user
sudo su
mkdir -p /root/deploy/sormas
cd /root/deploy/sormas
SORMAS_VERSION=1.63.1
wget https://github.com/hzi-braunschweig/SORMAS-Project/releases/download/v${SORMAS_VERSION}/sormas_${SORMAS_VERSION}.zip
unzip sormas_${SORMAS_VERSION}.zip
mv deploy/
$(date +%F) rm sormas_$ {SORMAS_VERSION}.zip chmod +x $(date +%F)/server-setup.sh - Note: you can edit server-setup.sh to customize install paths, database access and port numbers
- However, we recommend going with the defaults, which are satisfactory.
- Execute the following script to install sormas. (This script installs the sormas and sormas_audit databases, installs payara server and configures the payara domain.). cd $(date +%F) ./server-setup.sh
- Enter the appropriate responses when asked. a. Select Server setup type b. Select production server c. Select SORMAS authentication type
- Ensure that the script completes successfully