- Update the packages in the apt repo
sudo apt update -y && sudo apt upgrade -y
- Change the hostname of your server
sudo vim /etc/hostname
- Reboot your server to adopt new changes
sudo reboot
- Create a docker.sh file to automate the installation of docker
sudo vim docker.sh
- And paste this commands
#Add Docker's official GPG key:
sudo apt-get update -y
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings -y
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
#Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] 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 -y
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y
sudo docker run hello-world
- Make the docker.sh script executable
sudo chmod +x docker.sh
- Run the docker.sh script
./docker.sh
- Check docker version
docker --version
- Create a docker-compose.sh file to automate the installation of docker-compose
sudo vim docker-compose.sh
- And paste this commands
sudo curl -SL https://github.com/docker/compose/releases/download/v4.27.0/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
- Make the docker-compose.sh script executable
sudo chmod +x docker-compose.sh
- Run the docker-compose script
./docker-compose.sh
- Check the version of docker-compose
docker-compose -v
- Run this command to allow sudo privileges for the current user (ubuntu)
sudo chmod 666 /var/run/docker.sock
- Create a directory named odoo and change dir to odoo
mkdir ~/odoo
cd ~/odoo
- Create a docker-compose .yml file to automate the provisioning of Odoo and postgres docker container.
- Create a docker-compose file named docker-compose.yml
sudo vim docker-compose.yml
- Paste the following details.
version: '3.7'
services:
odoo:
image: odoo:17.0
env_file: .env
depends_on:
- postgres
ports:
- "8069:8069"
volumes:
- odoo-web-data:/var/lib/odoo
postgres:
image: postgres:15
env_file: .env
volumes:
- db:/var/lib/postgresql/data/pgdata
volumes:
odoo-web-data:
db:
- Create environmenatl variables to avoid reveal sensitive details
- Create a this
sudo vim .env
- Paste this details
#postgresql environment variables
POSTGRES_DB=postgres
POSTGRES_PASSWORD=a_strong_password_for_user
POSTGRES_USER=odoo
PGDATA=/var/lib/postgresql/data/pgdata
#odoo environment variables
HOST=postgres
USER=odoo
PASSWORD=a_strong_password_for_user
- Use this commands to generate a strong password that can be used in the .env file
openssl rand -base64 30
- Start the Odoo and postgres containers with the docker-compose command
docker-compose up -d
- Access Odoo UI from the http://ipaddress:8069
- To stop the Odoo and postgres containers with docker-compose command
docker-compose stop