Fix bug.
This commit is contained in:
parent
a61784b116
commit
26ded5c0ad
|
@ -2,7 +2,7 @@
|
||||||
ubuntu_version=$(lsb_release -rs)
|
ubuntu_version=$(lsb_release -rs)
|
||||||
sudo apt update
|
sudo apt update
|
||||||
if [[ $ubuntu_version =~ '14' ]]; then
|
if [[ $ubuntu_version =~ '14' ]]; then
|
||||||
sudo apt install libgmp-dev
|
sudo apt install libgmp-dev -y
|
||||||
fi
|
fi
|
||||||
echo "postfix postfix/mailname string $USER" | sudo debconf-set-selections
|
echo "postfix postfix/mailname string $USER" | sudo debconf-set-selections
|
||||||
echo "postfix postfix/main_mailer_type string 'Local only'" | sudo debconf-set-selections
|
echo "postfix postfix/main_mailer_type string 'Local only'" | sudo debconf-set-selections
|
||||||
|
@ -12,11 +12,10 @@ sudo apt install nginx -y
|
||||||
sudo service nginx restart
|
sudo service nginx restart
|
||||||
cd /etc/nginx/
|
cd /etc/nginx/
|
||||||
sudo mkdir orbit_sites/
|
sudo mkdir orbit_sites/
|
||||||
sudo vim nginx.conf
|
|
||||||
sudo sed -i 's/\(include\ \/etc\/nginx\/sites-enabled\/\*\;\)/\1\n\tinclude\ \/etc\/nginx\/sites-enabled\/\*\;\n\tinclude\ \/etc\/nginx\/orbit_sites\/*;/g' nginx.conf
|
sudo sed -i 's/\(include\ \/etc\/nginx\/sites-enabled\/\*\;\)/\1\n\tinclude\ \/etc\/nginx\/sites-enabled\/\*\;\n\tinclude\ \/etc\/nginx\/orbit_sites\/*;/g' nginx.conf
|
||||||
if [[ $ubuntu_version =~ '20' ]] || [[ $ubuntu_version =~ '21' ]]; then
|
if [[ $ubuntu_version =~ '20' ]] || [[ $ubuntu_version =~ '21' ]]; then
|
||||||
wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl1.0/libssl1.0.0_1.0.2n-1ubuntu5.6_amd64.deb
|
sudo wget -nc http://archive.ubuntu.com/ubuntu/pool/main/o/openssl1.0/libssl1.0.0_1.0.2n-1ubuntu5.7_amd64.deb
|
||||||
sudo dpkg -i libssl1.0.0_1.0.2n-1ubuntu5.6_amd64.deb
|
sudo dpkg -i libssl1.0.0_1.0.2n-1ubuntu5.7_amd64.deb
|
||||||
wget -qO - https://www.mongodb.org/static/pgp/server-5.0.asc | sudo apt-key add -
|
wget -qO - https://www.mongodb.org/static/pgp/server-5.0.asc | sudo apt-key add -
|
||||||
sudo apt-get install gnupg -y
|
sudo apt-get install gnupg -y
|
||||||
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list
|
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list
|
||||||
|
@ -24,26 +23,29 @@ if [[ $ubuntu_version =~ '20' ]] || [[ $ubuntu_version =~ '21' ]]; then
|
||||||
sudo apt-get install -y mongodb-org=5.0.6 mongodb-org-database=5.0.6 mongodb-org-server=5.0.6 mongodb-org-shell=5.0.6 mongodb-org-mongos=5.0.6 mongodb-org-tools=5.0.6
|
sudo apt-get install -y mongodb-org=5.0.6 mongodb-org-database=5.0.6 mongodb-org-server=5.0.6 mongodb-org-shell=5.0.6 mongodb-org-mongos=5.0.6 mongodb-org-tools=5.0.6
|
||||||
sudo service mongod restart
|
sudo service mongod restart
|
||||||
fi
|
fi
|
||||||
sudo bash -l -c "cd /root; \
|
if [ -z $(which convert) ]; then
|
||||||
apt-get install libjpeg62 -y; \
|
sudo bash -l -c "cd /root && \
|
||||||
wget http://download.sourceforge.net/libpng/libpng-1.5.13.tar.gz; \
|
apt-get install libjpeg62 -y && \
|
||||||
tar xvfz libpng-1.5.13.tar.gz; \
|
wget -nc http://download.sourceforge.net/libpng/libpng-1.5.13.tar.gz && \
|
||||||
cd libpng-1.5.13/; \
|
tar xvfz libpng-1.5.13.tar.gz && \
|
||||||
./configure; \
|
cd libpng-1.5.13/ && \
|
||||||
make && sudo make install; \
|
./configure && \
|
||||||
apt install -y libltdl-dev graphviz libpng-dev libfftw3-dev; \
|
make && sudo make install && \
|
||||||
apt-get install -y libjpeg-turbo8-dev; \
|
apt install -y libltdl-dev graphviz libpng-dev libfftw3-dev && \
|
||||||
apt install -y libgif-dev libjpeg-dev libopenexr-dev libpng-dev libwebp-dev; \
|
apt-get install -y libjpeg-turbo8-dev && \
|
||||||
apt install -y cmake pkg-config libbrotli-dev; \
|
apt install -y libgif-dev libjpeg-dev libopenexr-dev libpng-dev libwebp-dev && \
|
||||||
wget http://www.imagemagick.org/download/ImageMagick.tar.gz; \
|
apt install -y cmake pkg-config libbrotli-dev && \
|
||||||
tar xvfz ImageMagick.tar.gz; \
|
wget -nc http://www.imagemagick.org/download/ImageMagick.tar.gz && \
|
||||||
cd $(ls -d ImageMagick-7*); \
|
tar xvfz ImageMagick.tar.gz && \
|
||||||
./configure --with-bzlib=yes --with-fontconfig=yes --with-freetype=yes --with-gslib=yes --with-gvc=yes --with-jpeg=yes --with-jp2=yes --with-png=yes --with-tiff=yes --disable-shared --with-modules; \
|
cd $(ls -d ImageMagick-7*) && \
|
||||||
make && make install; \
|
./configure --with-bzlib=yes --with-fontconfig=yes --with-freetype=yes --with-gslib=yes --with-gvc=yes --with-jpeg=yes --with-jp2=yes --with-png=yes --with-tiff=yes --disable-shared --with-modules && \
|
||||||
ln -s /usr/local/lib/* /usr/lib/.; \
|
make && make install && \
|
||||||
ln -s /usr/local/lib/pkgconfig/* /usr/lib/pkgconfig/.; \
|
ln -s /usr/local/lib/* /usr/lib/. && \
|
||||||
ln -s /usr/local/bin/* /usr/bin/.; \
|
ln -s /usr/local/lib/pkgconfig/* /usr/lib/pkgconfig/. && \
|
||||||
convert -list configure;"
|
ln -s /usr/local/bin/* /usr/bin/. && \
|
||||||
|
convert -list configure"
|
||||||
|
fi
|
||||||
|
if [ -z $(which rvm) ]; then
|
||||||
sudo apt-get install software-properties-common -y
|
sudo apt-get install software-properties-common -y
|
||||||
sudo apt-add-repository -y ppa:rael-gc/rvm
|
sudo apt-add-repository -y ppa:rael-gc/rvm
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
|
@ -54,12 +56,12 @@ source "/etc/profile.d/rvm.sh"
|
||||||
sudo chown $USER:$USER $HOME -R
|
sudo chown $USER:$USER $HOME -R
|
||||||
rvm user gemsets
|
rvm user gemsets
|
||||||
rvm install 2.1.10
|
rvm install 2.1.10
|
||||||
|
fi
|
||||||
rvm --default use 2.1.10
|
rvm --default use 2.1.10
|
||||||
if [[ $ubuntu_version =~ '20' ]] || [[ $ubuntu_version =~ '21' ]]; then
|
if [[ $ubuntu_version =~ '20' ]] || [[ $ubuntu_version =~ '21' ]]; then
|
||||||
gem install nokogiri -v 1.7.0.1
|
gem install nokogiri -v 1.7.0.1
|
||||||
fi
|
fi
|
||||||
sudo apt-get install screen
|
sudo apt-get install screen -y
|
||||||
sudo vim /etc/rsyslog.d/50-default.conf
|
|
||||||
sudo sed -i 's/#cron\.\*/cron\.\*/g' /etc/rsyslog.d/50-default.conf
|
sudo sed -i 's/#cron\.\*/cron\.\*/g' /etc/rsyslog.d/50-default.conf
|
||||||
sudo service rsyslog restart
|
sudo service rsyslog restart
|
||||||
sudo mkdir /home/backup/db/ -p
|
sudo mkdir /home/backup/db/ -p
|
||||||
|
@ -73,42 +75,42 @@ matched_backup_home=$(grep -P "backup\t$HOME" /etc/rsnapshot.conf|xargs)
|
||||||
if [ -z $matched_backup_home ]; then
|
if [ -z $matched_backup_home ]; then
|
||||||
sudo sed -i "$(echo "s/^\(#backup\t\/home\/\t\)/backup\t$(echo $HOME|sed 's/\//\\\//g')\tlocalhost\/\n\1/g")" /etc/rsnapshot.conf
|
sudo sed -i "$(echo "s/^\(#backup\t\/home\/\t\)/backup\t$(echo $HOME|sed 's/\//\\\//g')\tlocalhost\/\n\1/g")" /etc/rsnapshot.conf
|
||||||
fi
|
fi
|
||||||
sudo wget http://gitlab.tp.rulingcom.com/erictyl/install_r45_on_ubuntu_1804lts_doc/-/raw/master/orbit_logrotate -O /etc/logrotate.d/orbit
|
sudo wget -nc http://gitlab.tp.rulingcom.com/erictyl/install_r45_on_ubuntu_1804lts_doc/-/raw/master/orbit_logrotate -O /etc/logrotate.d/orbit
|
||||||
sudo sed -i "s/rulingcom/$USER/g" /etc/logrotate.d/orbit
|
sudo sed -i "s/rulingcom/$USER/g" /etc/logrotate.d/orbit
|
||||||
sudo logrotate -d /etc/logrotate.conf
|
sudo logrotate -d /etc/logrotate.conf
|
||||||
sudo /usr/sbin/logrotate -f /etc/logrotate.conf
|
sudo /usr/sbin/logrotate -f /etc/logrotate.conf
|
||||||
sudo wget http://gitlab.tp.rulingcom.com/erictyl/install_r45_on_ubuntu_1804lts_doc/-/raw/master/orbit_service.sh -O /etc/init.d/orbit
|
sudo wget -nc http://gitlab.tp.rulingcom.com/erictyl/install_r45_on_ubuntu_1804lts_doc/-/raw/master/orbit_service.sh -O /etc/init.d/orbit
|
||||||
sudo sed -i "s/ORBIT_USER=.*/ORBIT_USER=$USER/g" /etc/init.d/orbit
|
sudo sed -i "s/ORBIT_USER=.*/ORBIT_USER=$USER/g" /etc/init.d/orbit
|
||||||
sudo chmod 755 /etc/init.d/orbit
|
sudo chmod 755 /etc/init.d/orbit
|
||||||
sudo update-rc.d orbit defaults
|
sudo update-rc.d orbit defaults
|
||||||
sudo systemctl enable mongod.service
|
sudo systemctl enable mongod.service
|
||||||
sudo_crontab_jobs=$(sudo crontab -l)
|
sudo_crontab_jobs=$(sudo crontab -l)
|
||||||
if [[ $sudo_crontab_jobs =~ "@reboot /bin/bash -l -c" ]]; then
|
if [[ "$sudo_crontab_jobs" =~ "@reboot /bin/bash -l -c" ]]; then
|
||||||
echo "Already exist reboot crontab!"
|
echo "Already exist reboot crontab!"
|
||||||
else
|
else
|
||||||
echo "Adding reboot crontab!"
|
echo "Adding reboot crontab!"
|
||||||
echo $sudo_crontab_jobs$'\n''@reboot /bin/bash -l -c "rm -f /tmp/mongodb-27017.sock && chown mongodb:mongodb /var/lib/mongodb/ -R && chown mongodb:mongodb /var/log/mongodb -R && /usr/sbin/service mongod restart && /etc/init.d/orbit restart"'| sudo crontab -
|
echo "$sudo_crontab_jobs"$'\n''@reboot /bin/bash -l -c "rm -f /tmp/mongodb-27017.sock && chown mongodb:mongodb /var/lib/mongodb/ -R && chown mongodb:mongodb /var/log/mongodb -R && /usr/sbin/service mongod restart && /etc/init.d/orbit restart"'| sudo crontab -
|
||||||
fi
|
fi
|
||||||
sudo_crontab_jobs=$(sudo crontab -l)
|
sudo_crontab_jobs=$(sudo crontab -l)
|
||||||
if [[ $sudo_crontab_jobs =~ "mongodump -o /" ]]; then
|
if [[ "$sudo_crontab_jobs" =~ "mongodump -o /" ]]; then
|
||||||
echo "Already exist mongodump crontab!"
|
echo "Already exist mongodump crontab!"
|
||||||
else
|
else
|
||||||
echo "Adding mongodump crontab!"
|
echo "Adding mongodump crontab!"
|
||||||
echo $sudo_crontab_jobs$'\n''0 3 * * * mongodump -o /home/backup/db/`date "+\%Y\%m\%d"`_db'| sudo crontab -
|
echo "$sudo_crontab_jobs"$'\n''0 3 * * * mongodump -o /home/backup/db/`date "+\%Y\%m\%d"`_db'| sudo crontab -
|
||||||
fi
|
fi
|
||||||
sudo_crontab_jobs=$(sudo crontab -l)
|
sudo_crontab_jobs=$(sudo crontab -l)
|
||||||
if [[ `echo $sudo_crontab_jobs | grep -P "rm -fr.*/db/"` ]]; then
|
if [[ `echo "$sudo_crontab_jobs" | grep -P "rm -fr.*/db/"` ]]; then
|
||||||
echo "Already exist remove old mongo backup crontab!"
|
echo "Already exist remove old mongo backup crontab!"
|
||||||
else
|
else
|
||||||
echo "Adding remove old mongo backup crontab!"
|
echo "Adding remove old mongo backup crontab!"
|
||||||
echo $sudo_crontab_jobs$'\n''0 4 * * * rm -fr /home/backup/db/`date --date="1 week ago" "+\%Y\%m\%d"`_db'| sudo crontab -
|
echo "$sudo_crontab_jobs"$'\n''0 4 * * * rm -fr /home/backup/db/`date --date="1 week ago" "+\%Y\%m\%d"`_db'| sudo crontab -
|
||||||
fi
|
fi
|
||||||
sudo_crontab_jobs=$(sudo crontab -l)
|
sudo_crontab_jobs=$(sudo crontab -l)
|
||||||
if [[ $sudo_crontab_jobs =~ "/usr/bin/rsnapshot" ]]; then
|
if [[ "$sudo_crontab_jobs" =~ "/usr/bin/rsnapshot" ]]; then
|
||||||
echo "Already exist rsnapshot crontab!"
|
echo "Already exist rsnapshot crontab!"
|
||||||
else
|
else
|
||||||
echo "Adding rsnapshot crontab!"
|
echo "Adding rsnapshot crontab!"
|
||||||
echo $sudo_crontab_jobs$'\n''15 4 * * * /usr/bin/rsnapshot daily'| sudo crontab -
|
echo "$sudo_crontab_jobs"$'\n''15 4 * * * /usr/bin/rsnapshot daily'| sudo crontab -
|
||||||
fi
|
fi
|
||||||
echo "Finish setting orbit environment!"
|
echo "Finish setting orbit environment!"
|
||||||
echo "Please install orbit web app and setting nginx for single web by yourself!"
|
echo "Please install orbit web app and setting nginx for single web by yourself!"
|
Loading…
Reference in New Issue