11.6 MariaDB安装
# cd /usr/local/src
# 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
# tar zxvf mariadb-10.2.6-linux-glibc_214-x86_64.tar.gz
# mv mariadb-10.2.6-linux-glibc_214-x86_64 /usr/local/mariadb
# cd /usr/local/mariadb
# ./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mariadb/ --datadir=/data/mariadb
- 创建mysql用户
- 创建mysql的basedir
- 创建mysql的datadir
- 执行完毕后执行
# echo $?
查看是否有错误,0是无错,1出错
# cp support-files/my-small.cnf /usr/local/mariadb/my.cnf
拷贝配置文件,配置文件的大小在于所指定的缓存大小不同# cp support-files/mysql.server /etc/init.d/mariadb
# vim/usr/local/mariadb/my.cnf
定义basedir和datadir和自定义参数conf=$basedir/my.cnf,配置了conf后需要在启动命令start脚本处,$bindir/mysqld_safe --defaults-file="$conf"# cp support-files/mysql.server /etc/init.d/mariadb
# /etc/init.d/mariadb start
启动mariadb# ps aux |grep mysql
或者# ps aux |grep mariadb
11.7/11.8/11.9 Apache安装
- Apache是一个基金会的名字,httpd才是我们要安装的软件包,早期它的名字就叫apache
- Apache官网www.apache.org
# wget http://mirrors.cnnic.cn/apache/httpd/httpd-2.4.27.tar.gz
# wget http://mirrors.hust.edu.cn/apache/apr/apr-1.5.2.tar.gz
# wget http://mirrors.hust.edu.cn/apache/apr/apr-util-1.5.4.tar.gz
- apr和apr-util是一个通用的函数库,它让httpd可以不关心底层的操作系统平台,可以很方便地移植(从linux移植到windows)
# tar zxvf httpd-2.4.26.tar.gz
# tar zxvf apr-util-1.5.4.tar.gz
# tar zxvf apr-1.5.2.tar.gz
# cd /usr/local/src/apr-1.5.2
# ./configure --prefix=/usr/local/apr
# make && make install
# cd /usr/local/src/apr-util-1.5.4
# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
# make && make install
# cd /usr/local/src/httpd-2.4.25
- ./configure \ --prefix=/usr/local/apache2.4 \ --with-apr=/usr/local/apr \ --with-apr-util=/usr/local/apr-util \ --enable-so \ 支持动态扩展 --enable-mods-shared=most 指定支持哪些动态扩展的模块,most为大多数模块 //这里的反斜杠是脱义字符,加上它我们可以把一行命令写成多行
# make && make install
//此步骤为编译# ls /usr/local/apache2.4/modules
# /usr/local/apache2.4/bin/httpd -M
//查看加载的模块# /usr/local/apache2.4/bin/apachectl -M
//查看加载的模块- static状态是和httpd绑定的,shared为扩展模块,是一个文件,/usr/local/apache2.4/modols下的
# /usr/local/apache2.4/bin/apachectl start
//启动apache
扩展
- apache dso
- apache apxs
- apache工作模式