<commit_before># Instructions to install libre.sh on linux with Systemd  

## Recommendation  
- Systemd (debian 8 or debian 9, CentOS 7 ...)  

# Installation  
Where basicly reproduce what the user_data do for us.  

as root  

# configure sshd  
Don't forget to create the user core and adding your ssh key before
You could also remove AllowUsers core or/and change the username.  
  
> 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  

# add kernel parameter  
  
> cat > /etc/sysctl.d/libresh.conf <<EOF  
fs.aio-max-nr=1048576  
vm.max_map_count=262144  
EOF  
> chmod 644 /etc/sysctl.d/libresh.conf
> sysctl -p  

# define Localhost
  
> cat > /etc/hosts <<EOF  
127.0.0.1 localhost  
255.255.255.255 broadcasthost  
::1 localhost  
EOF  

# define envrionment  
  
> 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="<EMAIL>"  
City="Lisbon"  
CountryCode="PT"  
BACKUP_DESTINATION=root@xxxxx:port  
MAIL_USER=  
MAIL_PASS=  
MAIL_HOST=mail.indie.host  
MAIL_PORT=587  
EOF  

# install docker-compose  
  
*Remark I did a variante to find the last version of DockerCompose and download it*
> 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  

# install Libre.sh  
  
> git clone https://github.com/indiehosters/libre.sh.git /libre.sh &&\  
> mkdir /{data,system} &&\  
> mkdir /data/trash &&\  
> 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/  

# add /opt/bin path  
  
> cat > /etc/profile.d/libre.sh <<EOF  
export PATH=$PATH:/opt/bin  
EOF  
chmod 644 /etc/profile.d/libre.sh  <commit_msg>Remove trailing space<commit_after># Instructions to install libre.sh on linux with Systemd

## Recommendation
- Systemd (debian 8 or debian 9, CentOS 7 ...)

# Installation
Where basicly reproduce what the user_data do for us.

as root

# configure sshd
Don't forget to create the user core and adding your ssh key before
You could also remove AllowUsers core or/and change the username.
  
> 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  

  
> cat > /etc/sysctl.d/libresh.conf <<EOF  
fs.aio-max-nr=1048576  
vm.max_map_count=262144  
EOF  
> chmod 644 /etc/sysctl.d/libresh.conf
> sysctl -p  
# add kernel parameter

# define Localhost
  
> cat > /etc/hosts <<EOF  
127.0.0.1 localhost  
255.255.255.255 broadcasthost  
::1 localhost  
EOF  

  
> 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="<EMAIL>"  
City="Lisbon"  
CountryCode="PT"  
BACKUP_DESTINATION=root@xxxxx:port  
MAIL_USER=  
MAIL_PASS=  
MAIL_HOST=mail.indie.host  
MAIL_PORT=587  
EOF  

  
# define envrionment
# install docker-compose
*Remark I did a variante to find the last version of DockerCompose and download it*
> 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  

  
> git clone https://github.com/indiehosters/libre.sh.git /libre.sh &&\  
> mkdir /{data,system} &&\  
> mkdir /data/trash &&\  
> 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/  

  
> cat > /etc/profile.d/libre.sh <<EOF  
export PATH=$PATH:/opt/bin  
EOF  
chmod 644 /etc/profile.d/libre.sh  
# install Libre.sh
# add /opt/bin path
{'fraction_non_alphanumeric': 0.1249475890985325, 'fraction_numerical': 0.025157232704402517, 'mean_word_length': 3.365050320219579, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 57, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7172318', 'n_tokens_mistral': 1920, 'n_tokens_neox': 1770, 'n_words': 404}