This repository contains scripts to automate the initial setup of an Ubuntu server.
The scripts are tested on 20.04LTS
22.04LTS
24.04LTS
-
Clone the repository:
git clone https://github.com/coderavehq/ubuntu-server-setup.git cd ubuntu-server-setup
-
Copy the example configuration file and edit the
config.cfg
file to add the desired users, passwords, and SSH public keys:cp config.cfg.example config.cfg nano config.cfg
-
Run the
run.sh
script:sudo bash run.sh
00_update_upgrade.sh
: Updates and upgrades the system.01_create_group_user.sh
: Creates users, adds them to the specified group, and sets up their SSH keys.02_configure_ssh.sh
: Configures SSH to disable root login and password authentication, and enables SSH key-based authentication.03_setup_ufw.sh
: Configures UFW firewall with the ports specified inconfig.cfg
.04_setup_swap.sh
: Sets up a swap file based on the installed RAM, and configures swappiness and vfs_cache_pressure.- Common scripts are stored in the
scripts/common/
folder.
- After running the scripts, you can log in to the server using the newly created users and their SSH keys.
- You can also set up additional services like Wireguard, Borg, or security tools like CrowdSec.
- Refer to the official Ubuntu documentation for more information on server setup and configuration.
This project is licensed under the MIT License - see the LICENSE file for details.