# Server Installation

Steps I did before this are:

* chosen the 2GB ram server, latest ubuntu 24.04
* bought the server, it started, they gave me the IP address
* pointed the domain core.haircomb.biz to the server IP address

## Login to the server

1. boot tails
2. type ssh root\@ip to the console
3. become aware about the public key (to avoid logging into wrong server in the future)
4. type password
5. ubuntu console is presented

## Initial things

1. type apt-get update; apt-get upgrade to update the fresh server
2. type apt-get install nginx to install basic web server

After this you go to <http://core.haircomb.biz> and there is a message welcome to nginx

## Cloning the repos from codeberg

`git clone https://codeberg.org/watashi564/combdownloader-ng`&#x20;

`git clone https://codeberg.org/watashi564/pricechart`&#x20;

`git clone https://codeberg.org/watashi564/combswapui`&#x20;

`git clone https://codeberg.org/watashi564/combfullui`

## Installing golang

`sudo add-apt-repository ppa:longsleep/golang-backports`&#x20;

`sudo apt update`&#x20;

`apt-get install golang`

I compile combfullui, combdownloader-ng, combswapui and pricechart using the usual way

Next I setup the nginx sites-available in /etc/nginx/sites-available

This is haircomb.org.conf:

`server {`&#x20;

&#x20;`client_header_buffer_size 2000k;`

&#x20;`large_client_header_buffers 16 2000k;`

&#x20;`listen 443 ssl;`&#x20;

&#x20;`server_name core.haircomb.org www.core.haircomb.org;`

&#x20;`ssl_certificate /etc/letsencrypt/live/core.haircomb.org-0001/fullchain.pem; # managed by Certbot`

&#x20;`ssl_certificate_key /etc/letsencrypt/live/core.haircomb.org-0001/privkey.pem; # managed by Certbot`&#x20;

&#x20;`location / {`&#x20;

&#x20; `proxy_pass http://127.0.0.1:21212;`&#x20;

&#x20;`}`

`}`

Generate dummy certs:

`openssl req -x509 -nodes -newkey rsa:4096 -days 1 -keyout "/etc/letsencrypt/live/swap.haircomb.biz-0001/privkey.pem" -out "/etc/letsencrypt/live/swap.haircomb.biz-0001/fullchain.pem" -subj '/CN=localhost'`

I setup configs, link sites-enabled to sites-available, restart nginx.

## Install certbot&#x20;

Install certbot using the digital ocean guide, then:

sudo certbot --nginx -d core.haircomb.biz -d swap.haircomb.biz

## Start the usual services

I start them on screen screens. It allows me to upgrade combfullui/combdownloader-ng with minimal downtime (if I restart it quickly, the downtime is less than a second).
