Skip to content
install.linux.sh 4.08 KiB
Newer Older
#This script is tested on Debian 12

#Current version of libre.sh to be installed 
LIBRE_VERSION=1.2
# System env vars  : can be overrided by a values.env file next to this install file
### CONFIG : Specify you template repo ROOT without training slash (Optional) or comment if you want to supply full url for apps
Michel Memeteau's avatar
Michel Memeteau committed
APP_REPO_URL="lab.libreho.st/libre.sh/compose"
## domain handling 

### CONFIG : change to your domain vendor ( namecheap, ovh , scaleway, )
DOMAIN_SERVER=namecheap

###  Namecheap specific
NAMECHEAP_URL="namecheap.com"
NAMECHEAP_API_USER="pierreo"
NAMECHEAP_API_KEY=

### ovh specific (WIP) 
OVH_URL="eu.api.ovh.com"
OVH_API_USER=""
OVH_API_KEY=


### Scaleway specific (WIP) 
SCALEWAY_URL=""
SCALEWAY_API_USER=""
SCALEWAY_API_KEY=


Michel Memeteau's avatar
Michel Memeteau committed
### TODO :  change your settings 
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
BACKUP_DESTINATION=root@xxxxx:port
Michel Memeteau's avatar
Michel Memeteau committed

### CONFIG  : Change your mail settings.
## SMTP
MAIL_USER=
MAIL_PASS=
MAIL_HOST=mail.indie.host
MAIL_PORT=587
# Default admin emails for apps

ADMIN_EMAIL=support@ekimia.fr

Michel Memeteau's avatar
Michel Memeteau committed
### TODO : source a setting file is present to override defaults
Michel Memeteau's avatar
Michel Memeteau committed
echo "-------- Welcome to libre.sh $LIBRE_VERSION installer"
echo "----  sourcing local values.env file if present"

source values.env

Michel Memeteau's avatar
Michel Memeteau committed
# STEP add kernel parameter
Michel Memeteau's avatar
Michel Memeteau committed
# STEP Define environnement

Michel Memeteau's avatar
Michel Memeteau committed
echo "-------- setting up system variables"

Michel Memeteau's avatar
Michel Memeteau committed
echo "APP_REPO_URL=${APP_REPO_URL}" >> /etc/environment
Michel Memeteau's avatar
Michel Memeteau committed

Michel Memeteau's avatar
Michel Memeteau committed
echo "LIBRE_VERSION=${LIBRE_VERSION}" >> /etc/environment
Michel Memeteau's avatar
Michel Memeteau committed

Michel Memeteau's avatar
Michel Memeteau committed
echo "MAIL_USER=${MAIL_USER}" >> /etc/environment
Michel Memeteau's avatar
Michel Memeteau committed

Michel Memeteau's avatar
Michel Memeteau committed
echo "MAIL_PASS=${MAIL_PASS}" >> /etc/environment
Michel Memeteau's avatar
Michel Memeteau committed

Michel Memeteau's avatar
Michel Memeteau committed
echo "MAIL_HOST=${MAIL_HOST}" >> /etc/environment
Michel Memeteau's avatar
Michel Memeteau committed

Michel Memeteau's avatar
Michel Memeteau committed
echo "MAIL_PORT=${MAIL_PORT}" >> /etc/environment
Michel Memeteau's avatar
Michel Memeteau committed

Michel Memeteau's avatar
Michel Memeteau committed
echo "MAIL_SECURITY=${MAIL_SECURITY}" >> /etc/environment


echo "ADMIN_EMAIL=${ADMIN_EMAIL}" >> /etc/environment

Michel Memeteau's avatar
Michel Memeteau committed

# STEP Install Docker 

Benzidane's avatar
Benzidane committed
# TODO : Fix a version for docker  ?
Benzidane's avatar
Benzidane committed
    dpkg -s $name &> /dev/null  
Benzidane's avatar
Benzidane committed
    if [ $? -ne 0 ]
Benzidane's avatar
Benzidane committed
        then
            echo "$name not installed"  
            apt-get update
#            curl -fsSL https://get.docker.com -o get-docker.sh
#            sh get-docker.sh
            apt install -y $name
            echo "-------- Native docker installed "
Benzidane's avatar
Benzidane committed

        else
            echo    "$name already installed"
    fi
Michel Memeteau's avatar
Michel Memeteau committed
# STEP "install docker-compose" 
echo "-------- Install native docker-compose "
Michel Memeteau's avatar
Michel Memeteau committed
# TODO : Fix a version for docker compose ? 

#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

apt install -y docker-compose

# STEP "install git"

echo "-------- Install git"

distro=$( ( lsb_release -ds || cat /etc/*release || uname -om ) 2>/dev/null | head -n1 | cut -d " " -f1)
if [[ "$distro" == "Ubuntu" || "$distro" == "Debian" ]]; then
Michel Memeteau's avatar
Michel Memeteau committed
apt-get install -y git
elif [[ "$distro" == "CentOS" || "$distro" == "AlmaLinux" || "$distro" == "Rocky" || "$distro" == "Fedora" ]]; then
yum install -y git
elif [[ "$distro" == "openSUSE" ]]; then
zypper install git
elif [[ "$distro" == "Arch" ]]; then
pacman -S git
elif [[ "$distro" == "Mageia" ]]; then
urpmi git
fi
Michel Memeteau's avatar
Michel Memeteau committed

# STEP install Libre.sh
echo " ---Removing previous install --- "
rm -rf /libre.sh

Michel Memeteau's avatar
Michel Memeteau committed
echo "-------- installing libre.sh" 
git clone https://lab.libreho.st/libre.sh/compose.libre.sh.git /libre.sh 
mkdir -p /{data,system}
Michel Memeteau's avatar
Michel Memeteau committed
mkdir -p /data/trash
mkdir -p /data/domains
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 
cp /libre.sh/utils/* /opt/bin/


Michel Memeteau's avatar
Michel Memeteau committed
# STEP add /opt/bin path
Michel Memeteau's avatar
Michel Memeteau committed
echo "-------- updating PATH" 
cat > /etc/profile.d/libre.sh <<EOF
export PATH=$PATH:/opt/bin
EOF
Michel Memeteau's avatar
Michel Memeteau committed
chmod 644 /etc/profile.d/libre.sh
Michel Memeteau's avatar
Michel Memeteau committed
bash /etc/profile.d/libre.sh

Michel Memeteau's avatar
Michel Memeteau committed
#TODO : reload profile to use libre right away