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:
Host
- declare hosts
Code
/etc/hosts
Exemple:
173.249.31.236 node2
144.91.95.252 node1
- change hostname
Edit hostname files
vim /etc/hostname
vim /etc/hosts
Change SSH
Open the /etc/ssh/sshd_config file
Locate the following line:
Port 7823
Restart the SSH service using the appropriate command for your Linux distribution:
service ssh restart
Docker
$ 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]
Swarm
docker swarm init --advertise-addr 144.91.95.252
Gluster
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
generate ssh
ssh-keygen -t rsa
probe “master only”
gluster peer probe node2; gluster pool list
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
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
Portainer
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