2017-07-03 10:18:57 +00:00
|
|
|
# Instructions to install libre.sh on linux with Systemd
|
2017-07-03 10:10:47 +00:00
|
|
|
|
2017-07-03 10:18:57 +00:00
|
|
|
## Recommendation
|
2020-01-18 14:59:54 +00:00
|
|
|
- Systemd distro (ubuntu server 18.04.3 or debian 9 )
|
2017-07-03 10:10:47 +00:00
|
|
|
|
2017-07-03 10:18:57 +00:00
|
|
|
# Installation
|
|
|
|
Where basicly reproduce what the user_data do for us.
|
2017-07-03 10:10:47 +00:00
|
|
|
|
2017-07-03 10:18:57 +00:00
|
|
|
as root
|
2017-07-03 10:10:47 +00:00
|
|
|
|
2020-01-17 21:53:46 +00:00
|
|
|
# configure sshd (Optional)
|
2017-07-03 10:10:47 +00:00
|
|
|
Don't forget to create the user core and adding your ssh key before
|
2017-07-03 10:18:57 +00:00
|
|
|
You could also remove AllowUsers core or/and change the username.
|
2017-07-03 10:19:15 +00:00
|
|
|
|
|
|
|
```
|
|
|
|
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
|
|
|
|
```
|
|
|
|
|
2020-01-17 21:53:46 +00:00
|
|
|
# add kernel parameter (optional but recommended )
|
2017-07-03 10:10:47 +00:00
|
|
|
|
2017-07-03 10:19:15 +00:00
|
|
|
```
|
|
|
|
cat > /etc/sysctl.d/libresh.conf <<EOF
|
|
|
|
fs.aio-max-nr=1048576
|
|
|
|
vm.max_map_count=262144
|
2017-08-21 15:36:13 +00:00
|
|
|
vm.overcommit_memory=1
|
2017-07-03 10:19:15 +00:00
|
|
|
EOF
|
|
|
|
chmod 644 /etc/sysctl.d/libresh.conf
|
2018-02-24 15:05:22 +00:00
|
|
|
sysctl -p /etc/sysctl.d/libresh.conf
|
2017-08-21 15:36:13 +00:00
|
|
|
|
|
|
|
echo never > /sys/kernel/mm/transparent_hugepage/enabled
|
2017-07-03 10:19:15 +00:00
|
|
|
```
|
|
|
|
|
2020-01-17 21:53:46 +00:00
|
|
|
# define Localhost (should not be needed but... )
|
2017-07-03 10:19:15 +00:00
|
|
|
|
|
|
|
```
|
|
|
|
cat > /etc/hosts <<EOF
|
|
|
|
127.0.0.1 localhost
|
|
|
|
255.255.255.255 broadcasthost
|
|
|
|
::1 localhost
|
|
|
|
EOF
|
|
|
|
```
|
|
|
|
|
2017-07-03 10:18:57 +00:00
|
|
|
# define envrionment
|
2017-07-03 10:19:15 +00:00
|
|
|
|
|
|
|
```
|
|
|
|
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
|
|
|
|
```
|
|
|
|
|
2020-01-18 14:59:54 +00:00
|
|
|
#install docker
|
|
|
|
|
|
|
|
# Current tested version : 19.03.5 see https://docs.docker.com/install/linux/docker-ce/ubuntu/
|
|
|
|
|
2017-07-03 10:18:57 +00:00
|
|
|
# install docker-compose
|
2017-07-03 10:19:15 +00:00
|
|
|
|
2017-07-03 10:10:47 +00:00
|
|
|
*Remark I did a variante to find the last version of DockerCompose and download it*
|
2017-07-03 10:19:15 +00:00
|
|
|
|
|
|
|
```
|
|
|
|
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
|
|
|
|
```
|
2017-07-03 10:18:57 +00:00
|
|
|
# install Libre.sh
|
2017-07-03 10:19:15 +00:00
|
|
|
|
|
|
|
```
|
2019-05-24 14:30:23 +00:00
|
|
|
git clone https://lab.libreho.st/libre.sh/compose.libre.sh /libre.sh &&\
|
2020-01-17 21:53:46 +00:00
|
|
|
mkdir -p /{data,system} &&\
|
|
|
|
mkdir -p /data/trash &&\
|
2017-07-03 10:19:15 +00:00
|
|
|
cp /libre.sh/unit-files/* /etc/systemd/system && systemctl daemon-reload &&\
|
|
|
|
systemctl enable web-net.service &&\
|
|
|
|
systemctl start web-net.service &&\
|
|
|
|
cp /libre.sh/utils/* /opt/bin/
|
|
|
|
```
|
|
|
|
|
2017-07-03 10:18:57 +00:00
|
|
|
# add /opt/bin path
|
2017-07-03 10:19:15 +00:00
|
|
|
|
|
|
|
```
|
|
|
|
cat > /etc/profile.d/libre.sh <<EOF
|
|
|
|
export PATH=$PATH:/opt/bin
|
|
|
|
EOF
|
|
|
|
chmod 644 /etc/profile.d/libre.sh
|
|
|
|
```
|