ensure you have a server with at least 2GB RAM and 2 CPUs use an installation of ubuntu 20.04 for this setup
connect to your server via ssh
sudo apt update && sudo apt upgrade -y
sudo apt install ufw sudo ufw allow OpenSSH sudo ufw enable sudo ufw status
PermitRootLogin no
ssh-keygen -t rsa -b 4096 ssh-copy-id yourusername@yourserver-ip
sudo apt install fail2ban sudo systemctl enable fail2ban sudo systemctl start fail2ban
sudo apt install apache2 sudo systemctl status apache2”
sudo apt-get install MySQL sudo apt-get install mysql-server
sudo apt install python3 sudo apt install python3-pip
sudo apt-get install -y curl openssh-server ca-certificates tzdata perl curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash sudo EXTERNAL_URL="http://your-server-domain-or-ip" apt-get install gitlab-ce sudo nano /etc/GitLab/GitLab.rb
create new GitLab project add CI/CD configuration stages:
- build
- test
- deploy
build: stage: build script: - echo "Building the application"
test: stage: test script: - echo "Running tests"
deploy: stage: deploy script: - echo "Deploying the application"
git add .gitlab-ci.yml git commit -m "Add CI/CD configuration" git push origin main
sudo git clone https://gitlab.com/stephen/npontu.git /var/www/html/yourapp
sudo systemctl restart apache2
sudo apt update && sudo apt upgrade -y Update GitLab
Regularly back up /var/www/html, GitLab data, and configuration files. Use cron jobs or backup solutions to automate this process.
Install monitoring tools like Prometheus or Grafana for tracking server health. Configure alerts for issues such as high CPU usage or low disk space.