INSTALL_LINUX.md 2.5 KB
Newer Older
Pierre Ozoux's avatar
Pierre Ozoux committed
1
# Instructions to install libre.sh on linux with Systemd
JꙨdцӍoηҬ's avatar
JꙨdцӍoηҬ committed
2

Pierre Ozoux's avatar
Pierre Ozoux committed
3
## Recommendation
Michel Memeteau's avatar
Michel Memeteau committed
4
- Systemd distro (ubuntu server 18.04.3 or debian 9 )
JꙨdцӍoηҬ's avatar
JꙨdцӍoηҬ committed
5

Pierre Ozoux's avatar
Pierre Ozoux committed
6 7
# Installation
Where basicly reproduce what the user_data do for us.
JꙨdцӍoηҬ's avatar
JꙨdцӍoηҬ committed
8

Pierre Ozoux's avatar
Pierre Ozoux committed
9
as root
JꙨdцӍoηҬ's avatar
JꙨdцӍoηҬ committed
10

Michel Memeteau's avatar
Michel Memeteau committed
11
# configure sshd (Optional)
JꙨdцӍoηҬ's avatar
JꙨdцӍoηҬ committed
12
Don't forget to create the user core and adding your ssh key before
Pierre Ozoux's avatar
Pierre Ozoux committed
13
You could also remove AllowUsers core or/and change the username.
Pierre Ozoux's avatar
Pierre Ozoux committed
14 15 16 17 18 19 20 21 22 23 24 25 26 27

```
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
28
# add kernel parameter (optional but recommended )
JꙨdцӍoηҬ's avatar
JꙨdцӍoηҬ committed
29

Pierre Ozoux's avatar
Pierre Ozoux committed
30 31 32 33
```
cat > /etc/sysctl.d/libresh.conf <<EOF
fs.aio-max-nr=1048576
vm.max_map_count=262144
34
vm.overcommit_memory=1
Pierre Ozoux's avatar
Pierre Ozoux committed
35 36
EOF
chmod 644 /etc/sysctl.d/libresh.conf
Samuel Laulhau's avatar
Samuel Laulhau committed
37
sysctl -p /etc/sysctl.d/libresh.conf
38 39

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

Michel Memeteau's avatar
Michel Memeteau committed
42
# define Localhost (should not be needed but... )
Pierre Ozoux's avatar
Pierre Ozoux committed
43 44 45 46 47 48 49 50 51

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

Pierre Ozoux's avatar
Pierre Ozoux committed
52
# define envrionment
Pierre Ozoux's avatar
Pierre Ozoux committed
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76

```
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
77
# install docker
Michel Memeteau's avatar
Michel Memeteau committed
78

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

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

JꙨdцӍoηҬ's avatar
JꙨdцӍoηҬ committed
83
*Remark I did a variante to find the last version of DockerCompose and download it*
Pierre Ozoux's avatar
Pierre Ozoux committed
84 85 86 87 88 89 90

```
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
91
# install Libre.sh
Pierre Ozoux's avatar
Pierre Ozoux committed
92 93

```
Michel Memeteau's avatar
Michel Memeteau committed
94
git clone https://lab.libreho.st/libre.sh/compose.libre.sh /libre.sh &&\
Michel Memeteau's avatar
Michel Memeteau committed
95 96
mkdir -p /{data,system} &&\
mkdir -p /data/trash &&\
Pierre Ozoux's avatar
Pierre Ozoux committed
97 98 99 100 101 102
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/
```

Pierre Ozoux's avatar
Pierre Ozoux committed
103
# add /opt/bin path
Pierre Ozoux's avatar
Pierre Ozoux committed
104 105 106 107 108 109 110

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