53 lines
1.7 KiB
Bash
53 lines
1.7 KiB
Bash
#!/bin/bash
|
|
# https://anystack.xyz/how-to-install-mastodon-ubuntu/
|
|
set -x
|
|
|
|
# Check if it is a Ubuntu host
|
|
/usr/bin/lsb_release -d|cut -d ":" -f 2|grep -i ubuntu|grep "16.04" 1>/dev/null
|
|
if [ $? == 0 ]
|
|
then
|
|
echo "C'est bien une Ubuntu"
|
|
else
|
|
exit 1
|
|
fi
|
|
|
|
if true; then
|
|
apt-get install -y redis-server redis-tools postgresql postgresql-contrib || exit 2
|
|
fi
|
|
|
|
if true; then
|
|
adduser --disabled-password --disabled-login --gecos "" mastodon || exit 3
|
|
chmod +r Install*.sh;chmod +x Install*.sh || exit 4
|
|
|
|
if [ -e ./Install-Mastodon-CreatePSQL-User.sh ]
|
|
then
|
|
# Creation de l'utilisateur Postgresql postgres
|
|
cp -f Install-Mastodon-CreatePSQL-User.sh /tmp || exit 5
|
|
chmod 644 /tmp/Install*.sh || exit 6
|
|
chmod +x /tmp/Install*.sh || exit 7
|
|
su - postgres -c /tmp/Install-Mastodon-CreatePSQL-User.sh || exit 8
|
|
rm -f /tmp/Install*.sh
|
|
else
|
|
exit 9
|
|
fi
|
|
fi
|
|
|
|
if true; then
|
|
sed -i '/^local.*postgres.*peer$/a host all all 127.0.0.1/32 ident' /etc/postgresql/9.?/main/pg_hba.conf || exit 10
|
|
apt-get -y install pidentd || exit 11
|
|
systemctl enable pidentd || exit 12
|
|
systemctl start pidentd || exit 13
|
|
systemctl restart postgresql || exit 14
|
|
apt-get install -y autoconf bison build-essential libssl-dev libyaml-dev || exit 15
|
|
apt-get install -y libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev || exit 16
|
|
apt-get install -y libgdbm3 libgdbm-dev || exit 17
|
|
fi
|
|
|
|
if true; then
|
|
cp Install-Mastodon-Phase3.sh Install-Mastodon-Phase4.sh /home/mastodon || exit 18
|
|
chown -R mastodon /home/mastodon || exit 19
|
|
chmod +x /home/mastodon/Install*.sh
|
|
su - mastodon -c ./Install-Mastodon-Phase3.sh || exit 20
|
|
su - mastodon -c ./Install-Mastodon-Phase4.sh || exit 21
|
|
fi
|