2018-5-24
11.7/11.8/11.9 Apache安裝
11.6 MariaDB安裝
安裝方法與mysql類似
wget https://downloads.mariadb.com/MariaDB/mariadb-10.2.6/bintar-linux-glibc_214-x86_64/mariadb-10.2.6-linux-glibc_214-x86_64.tar.gz
安裝這個包,然後解壓
同樣移動到//usr/local 改名mariadb
cd /usr/local/mariadb //進入到目錄下
同樣也是myqsl的用戶
./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mariadb/ --datadir=/data/mariadb //初始化
cp support-files/my-small.cnf /usr/local/mariadb/my.cnf //拷貝配置文件
vi /usr/local/mariadb/my.cnf //定義basedir和datadir
cp support-files/mysql.server /etc/init.d/mariadb //拷貝啟動腳本
vim /etc/init.d/mariadb //定義basedir、datadir、conf以及啟動參數
關閉mysqld服務,開啟mariadb
一臺機器同時安裝了mysql和maridb很少。需要給mariadb下的配置文件也寫上datadir 才不會出現問題
11.7/11.8/11.9 Apache安裝
Apache是一個基金會的名字,httpd才是我們要安裝的軟件包,早期它的名字就叫apache
Apache官網www.apache.org
下載apache 以及依賴的包
wget http://mirrors.cnnic.cn/apache/httpd/httpd-2.4.33.tar.gz
wget http://mirrors.hust.edu.cn/apache/apr/apr-1.6.3.tar.gz
wget http://mirrors.hust.edu.cn/apache/apr/apr-util-1.6.1.tar.gz.bz2
apr和apr-util是一個通用的函數庫,它讓httpd可以不關心底層的操作系統平臺,可以很方便地移植(從linux移植到windows)
下載完之後分別解壓
首先安裝apr
cd apr-1.6.3/
./configure --prefix=/usr/local/apr
make && make install
安裝apr-util
cd ../apr-util-1.6.1/
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make && make install
安裝httpd
cd /usr/local/src/httpd-2.4.33
./configure \ //這裏的反斜杠是脫義字符,加上它我們可以把一行命令寫成多行
--prefix=/usr/local/apache2.4 \
--with-apr=/usr/local/apr \
--with-apr-util=/usr/local/apr-util \
--enable-so \ //支持動態擴展
--enable-mods-shared=most //支持絕大多數模塊
make && make install
ls /usr/local/apache2.4/modules
/usr/local/apache2.4/bin/httpd -M //查看加載的模塊
報錯
libpcre沒有找到,安裝
實際編輯時出現錯誤
collect2: error: ld returned 1 exit status
make[2]: *** [htpasswd] 錯誤 1
make[2]: 離開目錄“/usr/local/src/httpd-2.4.27/support”
make[1]: *** [all-recursive] 錯誤 1
make[1]: 離開目錄“/usr/local/src/httpd-2.4.27/support”
make: *** [all-recursive] 錯誤 1
原因是因為apr,apr-util缺失,只需要把/usr/local/src下的apr和apr-util拷貝到./srclib下
#cd /usr/local/src/
#cp -r apr-1.6.2 /usr/local/src/httpd-2.4.27/srclib/apr
#cp -r apr-util-1.6.0 /usr/local/src/httpd-2.4.27/srclib/apr-util
#./configure --with-included-apr --prefix=/usr/local/apache2.4 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-so --enable-mods-shared=most
#make &&make install
安裝完成後cd /usr/local/apache2.4/
bin下面是可執行文件,裏面的httpd是核心二進制文件。
modules放了很多擴展文件。
/usr/local/apache2.4/bin/httpd -M //查看加載的模塊
啟動:/usr/local/apache2.4/bin/apachectl start
2018-5-24