IF語句安裝LAMP

2021-09-27 05:51:33 字數 2832 閱讀 7148

#!/bin/sh

#auto install lamp shell

#by zkg 2019-06-26

#定義apache變數

#定義mysql db變數

m_files=mysql-5.5.33.tar.gz

m_files_dir=mysql-5.5.33

m_url=

m_prefix=/usr/local/mysql55

#定義php變數

p_files=php-7.0.9.tar.gz

p_files_dir=php-7.0.9

p_url=

p_prefix=/usr/local/php7

#一鍵安裝選單

echo -e "\033[32m1)安裝apache web伺服器\033[1m"

echo "2)安裝mysql db伺服器"

echo "3)安裝php伺服器"

echo "4)整合lamp架構並啟動服務"

echo "please select install menu(1-4):"

read menu

if [ "$menu" -ne 1 -o "$menu" -ne 2 -o "$menu" -ne 3 -o "$menu" -ne 4 ];then

echo -e "\033[32mnot input 大於4或小於1的數字,please select install menu(1-4):\033[0m"

fi#安裝apache web伺服器

if [ "$menu" -eq 1 ];then

wget -c $h_url/$h_files && tar -xzvf $h_files && cd $h_files_dir && ./configure --prefix=$h_prefix

if [ $? -eq 0 ];then

make && make install

echo -e "\033[32mthe $h_files_dir server install successfully!\033[0m"

else

echo -e "\033[32mthe $h_files_dir server install failed,please check...!\033[0m"

exit 0

fifi

#安裝mysql db伺服器

if [ "$menu" -eq 2 ];then

wget -c $m_url/$m_files && tar -xzvf $m_files && cd $m_files_dir && yum -y install cmake;cmake . -dcmake_install_prefix=$m_prefix \

-dmysql_datadir=/data/myql \

-dwith_innobase_storage_engine=1 \

-dmysql_tcp_port=3306 \

-dmysql_unix_addr=/data/mysql.sock \

-dmysql_user=mysql \

-dwith_debug=0

cp support-files/my*.cnf /etc/my.cnf

cp support-files/mysql.server /etc/init.d/mysqld

chmod 755 /etc/init.d/mysqld

chkconfig --add mysqld

chkconfig mysqld on

if [ $? -eq 0 ];then

make && make install

echo -e "\033[32mthe $m_files_dir server install successfully!\033[0m"

else

echo -e "\033[32mthe $m_files_dir make or make install error,please check...!\033[0m"

exit 0

fi

fi

#安裝php伺服器

利用select和函式語句安裝LAMP

bin sh auto install lamp shell by zkg 2019 06 26 定義apache變數 定義mysql db變數 m files mysql 5.5.33.tar.gz m files dir mysql 5.5.33 m url m prefix usr local...

lAMP安裝手記

安裝過程 1.mysql的安裝 進雖ysql解壓的原始碼檔案目錄 configure prefix usr local mysql 設定mysql的安裝路徑 make make install 編譯,進行安裝。配置mysql groupadd mysql 新增mysql組 useradd g mys...

LAMP快速安裝

1.版本介紹 apache安裝 安裝mysql 5.5.48 安裝依賴 yum install ncurses devel libaio devel y cd server tools wget tar zxf cmake 2.8.8.tar.gz cd cmake 2.8.8 configure ...