Disclaimer this is a long guide, you might want to drink coffee first
Used proxmox add additional notes into installing on other physical devices / vm
Downloading Ubuntu
We are not savages so we are gonna use the LTS version, feel free to use other versions as of the date of this writing the latest is Ubuntu Server 22.04.2 LTS
Go to this page
Click on the download button an ISO file will be downloaded for you.
Things to do when download is completed
- Link will be added here in the future after i write a specific guide using the following
- Bootable Flashdrive for physical installation
- VM using VMWare or VirtualBox
- Promox Instance
Installing Ubuntu Server
- Start the machine
- Boot into the installation medium
- Detailed steps and screens are provided below
First Screen
Select `*Try or Install Ubuntu Server` press `enter`![grub](/_astro/grub.BOXvI9z__zH471.webp)
Ubuntu Live Boot
Wait for the live boot to finish
![aftergrub](/_astro/aftergrub.e2zPoyc__1q3Axr.webp)
Select Language
Select desired language, this is different from setting your locale
![languageselect](/_astro/languageselect.C5oUbBWs_1blMHB.webp)
Installer Update
The installer will update itself, feel free to skip this part use the arrow keys to navigate to Continue without updating
and press enter
![installerupdate](/_astro/languageselect.C5oUbBWs_1blMHB.webp)
Selecting Keyboard Layout
Keyboard layout most of the keyboard that are in PH is English(US/QWERTY)
![keyboardlayout](/_astro/keyboardlayout.KMPy2Ws7_ZHaW7f.webp)
Ubuntu Selection
Select Ubuntu Server
![ubuntuselection](/_astro/ubuntuselection.Dmwt0M1f_Z1T9VgB.webp)
Network Connection
As of this example my network is under 192.168.110.0/24
subnet, thats why my dhcp address in the screen is 192.168.110.85/24
yours might be 192.168.1.x/24
the most common subnets for home routers, if you dont know what you are doing skip the next part and just click done on this part, the next part is about manually asigning and ipv4 address.
![networkconnections](/_astro/networkconnections.Bqwo6gdh_duG64.webp)
Static IP Assignment
- Navigate to the ether port using arrow keys press
enter
then go toedit
![staticipmenu](/_astro/staticipmenu.C3jzoHoJ_HkqT.webp)
- A new popup below will show you what
IPv4 Method
you want to use pressenter
, you are in this section so selectManual
![ipv4method](/_astro/ipv4method.BTyd4DPa_fTBdB.webp)
![ipv4methodmanual](/_astro/ipv4methodmanual.BxmYcioa_2ecQIo.webp)
- A new popup with the following labels
Subnet , Address, Gateway, Name servers, Search domains
- Subnet e.g
192.168.1.0/24
if you dont understand it click here - Address e.g
192.168.1.137
you can replace 137, you dont know what it is? click here - Gateway e.g
192.168.1.1
your router address, for more info click here - Name servers e.g
8.8.8.8
is google’s public dns1.1.1.1
is cloudflare enter multitple with comma8.8.8.8,8.8.8.4
or1.1.1.1,1.1.1.4
![ipv4methodset](/_astro/ipv4methodset.C_n2dbLB_11vzsO.webp)
For reference here is what i entered while doing this guide
![ipv4methodexplain](/_astro/ipv4methodexplain.DVeqbbqn_Z1mOiOh.webp)
Network Setup Done
![ipv4methoddone](/_astro/ipv4methoddone.Cv9D4b4B_Z1FsAtG.webp)
Setup Mirror
Mirror is where we download packages from a certain server when we do something like apt install neovim
if you are not using any vpn, the installer will detect and give us ph server as default
![mirror](/_astro/mirror.4TTKQngK_ZV2ss1.webp)
Storage
I will not dive deep into this but this is basically where you set your storage size and partition depending on what machine you are doing this from it will show the hardisk in your system in this demo i allocated 32gb
of storage space and i will use it all, in your case if you are on a physical machine partition it well or use the entire ssd there is also an encryption option its up to you wether you want the data of this system encrypted or not press enter
![storage](/_astro/storageconfig.BjFRYuQR_Z19KwkA.webp)
Storage Configuration
This screen shows you how ubuntu assigns 3 partitions, sizes will depend on your storage medium used for the installation.
partition 1
is for theBIOS/UEFI
grub1MB
partition 2
is for the/boot
2GB
partition 3
is where your system files and/home/yourusername
will be stored29.997GB
Finish storage setup
If you are fine with the default settings ubuntu installer did Confirm
and Continue
this will format your storage
medium.
![storagedone](/_astro/storagedone.BqxDt6vs_Z7a0p4.webp)
Setup Profile
Fill up the following
Your name
e.gBruce Wayne
you can literally put anything hereServer name
e.gbat-server_73
this is how other machines recognize your machine aside from its MAC and IP addressesUsername
e.gbatman
this is important as you will use this to ssh e.gssh [email protected]
Password
e.giambatman
choose a secure password
Fill up Profile
![profile](/_astro/profiledone.KgXoQ4jp_Z1nJ3Rx.webp)
Ubuntu Pro
Well if you can afford why not?
![ubuntupro](/_astro/ubuntupro.COjB-ReD_1G6olh.webp)
Open SSH
Install it as we are gonna use OpenSSH server to connect and do more with our server
![openssh](/_astro/openssh.CzRY52R2_1xh3Ee.webp)
![opensshcheck](/_astro/opensshcheck.C24wjfud_1Cs1W0.webp)
Featured Snaps
In this screen we wont install anything as we will dockerize services like nextcloud
![featuredsnaps](/_astro/featuredsnaps.BwFgyxHo_Z3mhIl.webp)
Install Complete
Now the wait begins as get a cup of coffee, depending on how old your installer is the update will take long, Reboot
after it is done!
![complete](/_astro/complete.revkeLnW_Z1Rvbea.webp)
![completelog](/_astro/completelog.DsgemSmp_1FaWb4.webp)
![completereboot](/_astro/completereboot.D3Nc-iAY_8oiv8.webp)
Your first boot
First Boot
The machine is now ready to be hacked!
![firstboot](/_astro/firstboot.DZqRP0qD_Te4YL.webp)
![ready](/_astro/ready.D2gvFBQE_15tmvJ.webp)
Connecting to our server
SSH Login
Open a terminal in your workstation and connect through ssh
depending on what username and ipaddress of your server is assuming that you are on the same network you can use this command to connect to the server ssh username@ipv4address
a password will be asked
![sshlogin](/_astro/sshlogin.DJpaXhSu_Z3kfRL.webp)
Updating our server
First update
on your terminal update your server with the following commands these are 2 commands for just checking updates use sudo apt update
these updates and references the list of packages you have installed if a new version is released, sudo apt upgrade
upgrade all the packages
sudo apt update && sudo apt upgrade
After entering the command you will be prompted with Y/n
if you want to upgrade enter Y
and enter
Depending on how heavy the update is and whether it affects services a screen will appear in your terminal like the one below
![afterupgrade](/_astro/afterupgrade.B-x7xdnQ_Z2lal43.webp)
Installing Docker and Portainer
open your terminal copy paste the entire snippet and run it
sudo apt-get install ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyringscurl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpgsudo chmod a+r /etc/apt/keyrings/docker.gpg
echo \ "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \ sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-compose
Terminal Output
![installdocker](/_astro/installdocker.CjbMNsWH_MMsHr.webp)
![installdockerdone](/_astro/installdockerdone.BDPEpTZ9_1hcsp7.webp)
Checking docker installation
sudo docker ps
![installdockerps](/_astro/installdockerps.DmwAkVwO_6fPtQ.webp)
Additional docker commands to add you the $USER
so you dont need to sudo docker commands anymore
sudo groupadd dockersudo usermod -aG docker $USERnewgrp docker
Installing Portainer
The following command does the following for us
- downloads the latest portainer image
- sets the container to restart always on failure
- exposes port 9000 for http where we can access our portainer web page later at
192.168.110.133:9000
- adds volumes for its dependencies
- check the docs if you want to deploy it on https port on 9443
sudo docker run -d -p 8000:8000 -p 9443:9443 -p 9000:9000 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest
![portainerrun](/_astro/portainerrun.CL_uGwEa_p4PYI.webp)
After succesful installation we can now access the web page in your browser go to assignedIpv4:9000
replace ipv4 to whatever your dhcp server assigned to your server or whatever you set statically
Click live connect and you will be navigated to your local instance dashboard
![portainerdashboard](/_astro/portainerdashboard.Bsx6HXVI_2mz6J9.webp)
Go to app templates and feel free to install any template you want a good example would be File Browser
i havent used it myself but basically you can navigate your server files and folders in through your web browser
Installing Postgres and PgAdmin4
Before proceeding we can check that on our docker ps
command portainer exists and is running well
docker ps
![portainerup](/_astro/portainerup.mkBww_-U_1necYu.webp)
No we can start installing PostgresSQL and PgAdmin4 there are 2 ways we can install The first option is below
First option
- Create a docker volume where postgres sql db file will be persisted
sudo docker volume create postgresqldata
- Postgres Installation
- This downloads the postgres image from docker repository/registry
- Uses the volume we created earlier with
/data/db
location - Exposes the
5432
port, postgres defalt port, allows us to connect to postgres through192.168.110.133:5432
this address - Default username is
postgres
we set the password topostgres
feel free to replace it
sudo docker run -d -v postgresqldata:/data/db -e POSTGRES_PASSWORD=postgres --name postgres -p 5432:5432 postgres
- Install and run docker named pgadmin, replace
[email protected]
andsomethingsecret
with your email and desired password
- This downloads the dpage/pgadmin4 image from docker repository/registry
- Exposes the
8080
port, the default port is 80, but we can use that default http port for something else - We can access the web page through
192.168.110.8080
feel free to use other ports - replace
[email protected]
andsomethingsecret
with your email and desired password
sudo docker run --name pgadmin -e "[email protected]" -e "PGADMIN_DEFAULT_PASSWORD=somethingsecret" -p 8080:80 -d dpage/pgadmin4
![postgresrun](/_astro/postgresrun.COQl9M2c_Zh2eNz.webp)
- Connect them together
sudo docker network create --driver bridge pgnetworksudo docker network connect pgnetwork pgadminsudo docker network connect pgnetwork postgres# check network bridgedocker network inspect pgnetwork
![posgresnetwork](/_astro/postgresnetwork.Cy_LHHK8_KYzhM.webp)
Additional optins on portainer settings we could have done it on the commands above but i want to show you how to use the portainer also
Navigate and login to your portainer web page e.g
192.168.110.133:9000
Live connect to your local instance check containers and you will see the following
if You cant see the Published Ports of the container we created you did something wrong!
Click on the container
postgres
and if you scroll down you will seeContainer details
On
RESTART_POLICIES
where the default is set tonone
change it toalways
Do the same thing with
pgadmin
container
Second Option
Docker compose
version: '3.9'
services: pg: container_name: postgres image: postgres # automatically restarts the container - Docker daemon on restart or # the container itself is manually restarted restart: always volumes: - postgresqldata:/data/db
environment: POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres POSTGRES_DB: postgres ports: - '5432:5432' networks: - bridge - pgnetwork
pgadmin: container_name: pgadmin4 image: dpage/pgadmin4 restart: always
environment: PGADMIN_DEFAULT_PASSWORD: root
ports: - '8080:80' networks: - bridge - pgnetwork
volumes: postgresqldata:
networks: bridge: pgnetwork:
Create a docker-compose.yaml
anywhere in your home directory for me i store my docker-compose
files at composers
in the directory where you created your docker-compose.yaml
enter the following commands
docker compose up
Additional runtime dependencies needed
- build-essentials and cmake
- nvm(Node Version Manager)
sudo apt install build-essentials cmake zshtype -p curl >/dev/null || (sudo apt update && sudo apt install curl -y)curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \&& sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \&& sudo apt update \&& sudo apt install gh -y
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
clone dotfilescurl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash