2
0
mirror of https://github.com/frappe/bench.git synced 2025-02-03 11:28:24 +00:00

Add support for CentOS 7, fix #30

This commit is contained in:
Pratik Vyas 2014-10-13 20:02:10 +05:30
parent cef968bae6
commit 8d7550ce78

View File

@ -4,7 +4,7 @@ get_distro() {
ARCH=$(uname -m | sed 's/x86_/amd/;s/i[3-6]86/x86/') ARCH=$(uname -m | sed 's/x86_/amd/;s/i[3-6]86/x86/')
if [ -f /etc/redhat-release ]; then if [ -f /etc/redhat-release ]; then
OS="centos" OS="centos"
OS_VER=`cat /etc/redhat-release | cut -d" " -f3 | cut -d "." -f1` OS_VER=`cat /etc/redhat-release | sed 's/Linux\ //g' | cut -d" " -f3 | cut -d. -f1`
elif [ -f /etc/lsb-release ]; then elif [ -f /etc/lsb-release ]; then
. /etc/lsb-release . /etc/lsb-release
@ -76,7 +76,7 @@ add_maria_db_repo() {
} }
install_packages() { install_packages() {
if [ $OS == "centos" ]; then if [ $OS == "centos" ] && [ $OS_VER == "6" ]; then
sudo yum install wget -y sudo yum install wget -y
add_ius_repo add_ius_repo
sudo yum groupinstall -y "Development tools" sudo yum groupinstall -y "Development tools"
@ -85,6 +85,15 @@ install_packages() {
sudo rpm -Uvh wkhtmltox-0.12.1_linux-centos6-amd64.rpm sudo rpm -Uvh wkhtmltox-0.12.1_linux-centos6-amd64.rpm
easy_install-2.7 -U pip easy_install-2.7 -U pip
elif [ $OS == "centos" ] && [ $OS_VER == "7" ]; then
sudo yum install wget -y
add_epel_centos7
sudo yum groupinstall -y "Development tools"
sudo yum install -y git mariadb-server mariadb-server mariadb-devel python-setuptools nginx zlib-devel bzip2-devel openssl-devel memcached postfix python-devel libxml2 libxml2-devel libxslt libxslt-devel redis libXrender libXext supervisor
wget http://downloads.sourceforge.net/project/wkhtmltopdf/0.12.1/wkhtmltox-0.12.1_linux-centos6-amd64.rpm
sudo rpm -Uvh wkhtmltox-0.12.1_linux-centos6-amd64.rpm
easy_install-2.7 -U pip
elif [ $OS == "debian" ]; then elif [ $OS == "debian" ]; then
sudo apt-get update sudo apt-get update
sudo apt-get install python-dev python-setuptools build-essential python-mysqldb git memcached ntp vim screen htop mariadb-server mariadb-common libmariadbclient-dev libxslt1.1 libxslt1-dev redis-server libssl-dev libcrypto++-dev postfix nginx supervisor python-pip fontconfig libxrender1 -y sudo apt-get install python-dev python-setuptools build-essential python-mysqldb git memcached ntp vim screen htop mariadb-server mariadb-common libmariadbclient-dev libxslt1.1 libxslt1-dev redis-server libssl-dev libcrypto++-dev postfix nginx supervisor python-pip fontconfig libxrender1 -y
@ -142,6 +151,13 @@ start_services_centos() {
service memcached start service memcached start
} }
start_services_centos7() {
systemctl start nginx
systemctl start mariadb
systemctl start redis
systemctl start supervisord
}
configure_services_centos() { configure_services_centos() {
chkconfig --add supervisord chkconfig --add supervisord
chkconfig redis on chkconfig redis on
@ -150,6 +166,14 @@ configure_services_centos() {
chkconfig supervisord on chkconfig supervisord on
} }
configure_services_centos7() {
systemctl enable nginx
systemctl enable mariadb
systemctl enable redis
systemctl enable supervisord
}
add_ius_repo() { add_ius_repo() {
if [ $ARCH == "amd64" ]; then if [ $ARCH == "amd64" ]; then
T_ARCH="x86_64" T_ARCH="x86_64"
@ -164,6 +188,10 @@ add_ius_repo() {
fi fi
} }
add_epel_centos7() {
yum install -y epel-release
}
install_bench() { install_bench() {
sudo su $FRAPPE_USER -c "cd /home/$FRAPPE_USER && git clone https://github.com/frappe/bench bench-repo" sudo su $FRAPPE_USER -c "cd /home/$FRAPPE_USER && git clone https://github.com/frappe/bench bench-repo"
if hash pip-2.7; then if hash pip-2.7; then
@ -187,10 +215,15 @@ get_distro
add_maria_db_repo add_maria_db_repo
install_packages install_packages
add_user add_user
if [ $OS == "centos" ]; then if [ $OS == "centos" ] && [ $OS_VER == "6"]; then
install_supervisor_centos install_supervisor_centos
configure_services_centos configure_services_centos
start_services_centos start_services_centos
configure_mariadb_centos configure_mariadb_centos
fi fi
if [ $OS == "centos" ] && [ $OS_VER == "7"]; then
configure_services_centos7
start_services_centos7
configure_mariadb_centos
fi
install_bench install_bench