Vps Config

Nov 20, 2022 • edited Dec 14, 2022 • 2 minutes to read

A server configuration is a set of instructions that tells a computer how to operate. The instructions can include the type of hardware to use, the software to install, and the settings to use. A server configuration can be used to set up a new computer, or to change the settings on an existing computer. Here is the configuration I usually use for my fresh new sever:


  1. declare hosts



Exemple: node2 node1
  1. change hostname

Edit hostname files

vim /etc/hostname
vim /etc/hosts

Change SSH

  1. Open the /etc/ssh/sshd_config file

  2. Locate the following line:

     Port 7823
  3. Restart the SSH service using the appropriate command for your Linux distribution:

     service ssh restart


  $ apt install docker docker-compose -y
  $ sudo systemctl start docker
  $ sudo systemctl enable docker
  $ sudo usermod -aG docker $USER
  $ sudo newgrp docker
  $ sudo usermod -aG docker [non-root user]


    docker swarm init --advertise-addr


  1. install in all nodes:

     sudo apt-get install software-properties-common -y
     sudo apt-get update
     sudo apt install glusterfs-server -y
     sudo systemctl start glusterd
     sudo systemctl enable glusterd
  2. generate ssh

     ssh-keygen -t rsa
  3. probe “master only”

     gluster peer probe node2;
     gluster pool list
  4. create volume “all machines”

     sudo mkdir -p /gluster/swarm

“master only”

    sudo gluster volume create swarm-gfs replica 2 node1:/gluster/swarm node2:/gluster/swarm force
  1. start volume

     sudo gluster volume start swarm-gfs
     echo 'localhost:/swarm-gfs /mnt glusterfs defaults,_netdev,backupvolfile-server=localhost 0 0' >> /etc/fstab
     mount.glusterfs localhost:/swarm-gfs /mnt
     chown -R root:docker /mnt


ON manager

    curl -L https://downloads.portainer.io/portainer-agent-stack.yml -o portainer-agent-stack.yml
    docker stack deploy         --compose-file=portainer-agent-stack.yml portainer

Stackoverflow Source