Skip to content
INSTALL_LINUX.md 2.52 KiB
Newer Older
Pierre Ozoux's avatar
Pierre Ozoux committed
# Instructions to install libre.sh on linux with Systemd
Pierre Ozoux's avatar
Pierre Ozoux committed
## Recommendation
Michel Memeteau's avatar
Michel Memeteau committed
- Systemd distro (ubuntu server 18.04.3 or debian 9 )
Pierre Ozoux's avatar
Pierre Ozoux committed
# Installation
Where basicly reproduce what the user_data do for us.
Pierre Ozoux's avatar
Pierre Ozoux committed
as root
Michel Memeteau's avatar
Michel Memeteau committed
# configure sshd (Optional)
JꙨdцӍoηҬ's avatar
JꙨdцӍoηҬ committed
Don't forget to create the user core and adding your ssh key before
Pierre Ozoux's avatar
Pierre Ozoux committed
You could also remove AllowUsers core or/and change the username.
Pierre Ozoux's avatar
Pierre Ozoux committed

```
cat > /etc/ssh/sshd_config <<EOF
UsePrivilegeSeparation sandbox
Subsystem sftp internal-sftp
PermitRootLogin no
AllowUsers core
PasswordAuthentication no
ChallengeResponseAuthentication no
EOF
chmod 600 /etc/ssh/sshd_config
systemctl restart sshd
```

Michel Memeteau's avatar
Michel Memeteau committed
# add kernel parameter (optional but recommended )
Pierre Ozoux's avatar
Pierre Ozoux committed
```
cat > /etc/sysctl.d/libresh.conf <<EOF
fs.aio-max-nr=1048576
vm.max_map_count=262144
vm.overcommit_memory=1
Pierre Ozoux's avatar
Pierre Ozoux committed
EOF
chmod 644 /etc/sysctl.d/libresh.conf
sysctl -p /etc/sysctl.d/libresh.conf

echo never > /sys/kernel/mm/transparent_hugepage/enabled
Pierre Ozoux's avatar
Pierre Ozoux committed
```

Michel Memeteau's avatar
Michel Memeteau committed
# define Localhost (should not be needed but... )
Pierre Ozoux's avatar
Pierre Ozoux committed

```
cat > /etc/hosts <<EOF
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
EOF
```

Pierre Ozoux's avatar
Pierre Ozoux committed
# define envrionment
Pierre Ozoux's avatar
Pierre Ozoux committed

```
cat > /etc/environment <<EOF
NAMECHEAP_URL="namecheap.com"
NAMECHEAP_API_USER="pierreo"
NAMECHEAP_API_KEY=
IP="curl -s http://icanhazip.com/"
FirstName="Pierre"
LastName="Ozoux"
Address=""
PostalCode=""
Country="Portugal"
Phone="+351.967184553"
EmailAddress="pierre@ozoux.net"
City="Lisbon"
CountryCode="PT"
BACKUP_DESTINATION=root@xxxxx:port
MAIL_USER=
MAIL_PASS=
MAIL_HOST=mail.indie.host
MAIL_PORT=587
EOF
```

Michel Memeteau's avatar
Michel Memeteau committed
# install docker
Michel Memeteau's avatar
Michel Memeteau committed

Michel Memeteau's avatar
Michel Memeteau committed
*Current tested version : 19.03.5 see https://docs.docker.com/install/linux/docker-ce/ubuntu/ .*  
Michel Memeteau's avatar
Michel Memeteau committed

Pierre Ozoux's avatar
Pierre Ozoux committed
# install docker-compose
Pierre Ozoux's avatar
Pierre Ozoux committed

JꙨdцӍoηҬ's avatar
JꙨdцӍoηҬ committed
*Remark I did a variante to find the last version of DockerCompose and download it*
Pierre Ozoux's avatar
Pierre Ozoux committed

```
mkdir -p /opt/bin &&\
dockerComposeVersion=$(curl -s https://api.github.com/repos/docker/compose/releases/latest|grep tag_name|cut -d'"' -f4) &&\
curl -L https://github.com/docker/compose/releases/download/$dockerComposeVersion/docker-compose-`uname -s`-`uname -m` > /opt/bin/docker-compose &&\
chmod +x /opt/bin/docker-compose
```
Pierre Ozoux's avatar
Pierre Ozoux committed
# install Libre.sh
Pierre Ozoux's avatar
Pierre Ozoux committed

```
Michel Memeteau's avatar
Michel Memeteau committed
git clone https://lab.libreho.st/libre.sh/compose.libre.sh /libre.sh &&\
Michel Memeteau's avatar
Michel Memeteau committed
mkdir -p /{data,system} &&\
mkdir -p /data/trash &&\
Pierre Ozoux's avatar
Pierre Ozoux committed
cp /libre.sh/unit-files/* /etc/systemd/system && systemctl daemon-reload &&\
systemctl enable web-net.service &&\
systemctl start web-net.service &&\
mkdir -p /opt/bin &&\
Pierre Ozoux's avatar
Pierre Ozoux committed
cp /libre.sh/utils/* /opt/bin/
```

Pierre Ozoux's avatar
Pierre Ozoux committed
# add /opt/bin path
Pierre Ozoux's avatar
Pierre Ozoux committed

```
cat > /etc/profile.d/libre.sh <<EOF
export PATH=$PATH:/opt/bin
EOF
chmod 644 /etc/profile.d/libre.sh
```