Simple linux server setup created for a school project. All of this is made for AWS since that's what we used for the project. You shouldn't have too many problems if you use another Redhat distro but I can't guarantee it. Have fun !
WARNING: This repo assumes that you have at least 2 servers (main and backup servers), take this into consideration before using.
Inside of Backups/backup-script.sh, make sure to add the email you're going to use for the GPG encryption (if you're unsure, just make sure to put the same email every time you're prompted)
Also configure SSH on both the main server and the backup server:
On the main server:
ssh-keygen -t ed25519 -f ~/.ssh/backup_key -N ""
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
On the backup server:
cat ~/.ssh/backup_key.pub # COPY THE OUTPUT
You can test the connection with ssh -i ~/.ssh/backup_key backups@10.42.0.234
Write the ip address of your main server in main-server-ip.txt
Write the ip address of your backup server in backup-server-ip.txt \
Warning ! If your network address isn't 10.42.0.0/24, edit the /NFS/nfs-main-server.sh AND /NTP/ntm-main-server.sh and replace '10.42.0.0/24' with your network address. \
Usage of the setup.sh script: On main server: sudo ./setup.sh -m On backup server: sudo ./setup.sh -b
The current cron file is set so that the server is backed up every 12h, go ahead and change that to your liking BEFORE running the script by editing the Backups/cron-config.txt file.
Nothing else will work.
- The setup script installs the different requirements
- Prompts for the RAID1 and monitoring setup
The two points above need to run on both main and backup server
Then if the user is on the main server:
- The script creates a project folder to store the backup script
- Runs the backup script
- Runs the ftp setup for the main server
- Runs the nfs setup for the main server
- Runs the ntp setup for the main server
- Adds the backups to the crontab file
Or if the user is on the backup server:
- Runs the ftp setup for the backup server
- Runs the nfs setup for the backup server
- Runs the ntp setup for the backup server
- Add easy user configuration
- Run requirements script
- Ask what server user is on (main or backup)
- Run raid1 setup
- (optionnal) run raid1 status check
- Run monitoring script
If user is on main server:
- Run backup script
- Add crontab line to crontab for backups
- Run ftp main server script
- Run nfs main server script
- Run ntp main server script
If user is on backup server:
- Run ftp backup server script
- Run nfs client server script
- Run ntp client server script