11.6 Maria DB 安装
#cd /usr/local/src
下载mariadb 10.2.6 64位
#wget https://mirrors.tuna.tsinghua.edu.cn/mariadb//mariadb-10.2.14/bintar-linux-glibc_214-x86_64/mariadb-10.2.14-linux-glibc_214-x86_64.tar.gz
解压包
#tar zxvf mariadb-10.2.6-linux-glibc_214-x86_64.tar.gz
把解压了的目录移动并命名/usr/local/mariadb,因为要和mysql的目录区分。
mv mariadb-10.2.6-linux-glibc_214-x86_64 /usr/local/mariadb
检查以上输出结果
#echo $? 0
进入/usr/local/mariadb,并稍后进行初始化
初始化命令,指定user(user都是mysql)以及datadir(datadir指定了的/data/mariadb会自动生成)
#cd /usr/local/mariadb # ./scripts/mysql_install_db --user=mysql --datadir=/data/mariadb [root@centos7-01 mariadb]# ls /data/mariadb/ aria_log.00000001 ib_buffer_pool ib_logfile0 mysql test aria_log_control ibdata1 ib_logfile1 performance_schema
cp配置文件
cp support-files/my-small.cnf /usr/local/mariadb/my.cnf
修改和定义mysqld的basedir和datadir 这里一般保持默认即可
#
vim /usr/local/mariadb/my.cnf
cp启动脚本定义basedir和datadir
#
cp support-files/mysql.server /etc/init.d/mariadb
vim /etc/init.d/mariadb #定义basedir、datadir、conf以及启动参数
启动之前,先检查一下mysqld的进程有没有在开启,因为mysqld跟mariadb监听的端口是一样的,同时启动会发生冲突
[root@centos7-01 mariadb]# ps aux |grep mysqld root 4935 0.0 0.0 112676 984 pts/0 S+ 17:26 0:00 grep --color=auto mysqld
mysqld无启动,开启mariadb
/etc/init.d/mariadb start [root@centos7-01 mariadb]# /etc/init.d/mariadb start Reloading systemd: [ 确定 ] Starting mariadb (via systemctl): [ 确定 ] [root@centos7-01 mariadb]# echo $? 0
检查进程及监听端口的状态,进程之所以显示mysqld是因为mariadb是mysqld的分支,所以很多名字进程有相关mysqld的字眼, 但最终看mariadb的关键信息。
mysqld与mariadb的配置和用法大致都是一样的
11.7-11.9 安装Apache
Apache是一个基金会的名字,httpd才是我们要安装的软件包,早期它的名字就叫apache
Apache官网www.apache.org
分别下载 apr-1.6.3 apr-util 1.6.1 httpd-2.4.33
wget http://mirrors.cnnic.cn/apache/apr/apr-1.6.3.tar.gz wget http://mirrors.cnnic.cn/apache/apr/apr-util-1.6.1.tar.bz2 wget http://mirrors.cnnic.cn/apache/httpd/httpd-2.4.33.tar.gz
apr和apr-util是一个通用的函数库,它让httpd可以不关心底层的操作系统平台,可很方便地移植(从linux移植到windows)
它是靠函数来运行,无论系统平台是什么都不会影响。
分别解压apr-1.6.3 apr-util 1.6.1 httpd-2.4.33
tar zxvf httpd-2.4.33.tar.gz tar jxvf apr-util-1.6.1.tar.bz2 ar zxvf apr-1.6.3.tar.gz
首先安装apr
cd /usr/local/src/apr-1.6.3.tar.gz ./configure --prefix=/usr/local/apr
检查是否成功
echo $? 0
make && make install
检查是否成功
echo $? 0
然后安装apr-util 1.6.1
cd /usr/local/src/apr-util-1.6.1
apr-util要依赖apr的路径
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr make && make install
发现错误
解决方法:
缺少expat.h文件,yum安装:
#yum install -y expat-devel; 安装完成后,重新执行上面的命令!
安装httpd-2.4
#cd /usr/local/src/httpd-2.4.33
安装参数
./configure --prefix=/usr/local/apache2.4 --with-apr=/usr/local/apr --with-apr-util=/usr/lcal/apr-util --enable-so --enable-mods-shared=most
./configure \ //这里的反斜杠是脱义字符,加上它我们可以把一行命令写成多行
--prefix=/usr/local/apache2.4 \
--with-apr=/usr/local/apr \
--with-apr-util=/usr/local/apr-util \
--enable-so \ 支持动态扩展模块,apache php都支持以一个模块存在。
--enable-mods-shared=most 支持大部分模块
安装期间,出现报错信息,大致内容就是缺了某个包。
利用#yum list 去追踪导致错误信息的包
yum list configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/
再次编译,继续出错,继续排查安装包
./configure --prefix=/usr/local/apache2.4 --with-apr=/usr/local/apr --with-apr-util=/usr/lcal/apr-util --enable-so --enable-mods-shared=most checking for chosen layout... Apache checking for working mkdir -p... yes checking for grep that handles long lines and -e... /usr/bin/grep checking for egrep... /usr/bin/grep -E checking build system type... x86_64-pc-linux-gnu checking host system type... x86_64-pc-linux-gnu checking target system type... x86_64-pc-linux-gnu configure: configure: Configuring Apache Portable Runtime library... configure: checking for APR... yes setting CC to "gcc" setting CPP to "gcc -E" setting CFLAGS to " -g -O2 -pthread" setting CPPFLAGS to " -DLINUX -D_REENTRANT -D_GNU_SOURCE" setting LDFLAGS to " " configure: configure: Configuring Apache Portable Runtime Utility library... configure: checking for APR-util... configure: error: the --with-apr-util parameter is incorrect. It must specify an install prefix, a build directory, or an apu-config file.
解决方法:
# 安装libxml2-devel包 yum install -y libxml2-devel # 删除apr-util安装目录,并重新编译安装 rm -rf /usr/local/apr-util cd /usr/local/src/apr-util-1.6.1 # 这一步很重要,必须清除之前配置时的缓存 make clean ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr make && make install # 重新编译安装httpd cd /usr/local/src/httpd-2.4.29 # 同样要清理之前的缓存十分重要 make clean ./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
利用一般devel就是库包,所以选择安装有关devel的包名安装。
[root@Centos7-01 httpd-2.4.33]# yum list |grep -i pcre pcre-devel.x86_64 8.32-17.el7 base
再次编译
./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 //查看加载的模块
[root@DD-Server-9F ~]# /usr/local/apache2.4/bin/httpd -M AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::2ad9:5a78:700c:eaee. Set the 'ServerName' directive globally to suppress this message Loaded Modules: core_module (static) so_module (static) http_module (static) mpm_event_module (static) authn_file_module (shared) authn_core_module (shared) authz_host_module (shared) authz_groupfile_module (shared) authz_user_module (shared) authz_core_module (shared) access_compat_module (shared) auth_basic_module (shared) reqtimeout_module (shared) filter_module (shared) mime_module (shared) log_config_module (shared) env_module (shared) headers_module (shared) setenvif_module (shared) version_module (shared) unixd_module (shared) status_module (shared) autoindex_module (shared) dir_module (shared) alias_module (shared)
httpd简化版安装
####3 安装apache
分别下载 apr-1.6.3 apr-util 1.6.1 httpd-2.4.33 到/usr/local/src/
wget http://mirrors.cnnic.cn/apache/apr/apr-1.6.3.tar.gz wget http://mirrors.cnnic.cn/apache/apr/apr-util-1.6.1.tar.bz2 wget http://mirrors.cnnic.cn/apache/httpd/httpd-2.4.33.tar.gz
1、首先安装apr
cd /usr/local/src/apr-1.6.3 ./configure --prefix=/usr/local/apr
2、然后安装apr-util 1.6.1
cd /usr/local/src/apr-util-1.6.1
apr-util要依赖apr的路径
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr make && make install
3、安装httpd-2.4
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