设为首页 收藏本站
查看: 763|回复: 0

[经验分享] MariaDB和 Apache安装

[复制链接]

尚未签到

发表于 2018-11-18 06:34:14 | 显示全部楼层 |阅读模式
11.6 MariaDB安装
准备工作
  方法1:
因为MariaDB的二进制包镜像源在国外地址,所以预先下载了该包到本地物理机,使用lrzsz工具将该包上传至虚拟机/usr/local/src目录进行安装。
  先安装lrzsz工具:
[root@centos-01 src]# yum install -y lrzsz
  上传本地包到虚拟终端:
  [root@centos-01 ~]# cd /usr/local/src
[root@centos-01 src]# ls
mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz
[root@centos-01 src]# rz
  [root@centos-01 src]# ls
mariadb-10.2.6-linux-glibc_214-x86_64.tar.gz  mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz
  方法2:
  通过百度网盘下载到WIN7系统下,再安装一个XFTP 5
[root@centos-01 ~]# cd /usr/local/src
再点上传图标,把软件传到linux的/usr/local/src下
DSC0000.jpg

安装MariaDB
  解压包
  [root@centos-01  src]# tar zxvf mariadb-10.2.6-linux-glibc_214-x86_64.tar.gz
[root@centos-01 src]# mv mariadb-10.2.6-linux-glibc_214-x86_64 /usr/local/mariadb
[root@centos-01 src]# cd /usr/local/mariadb
  初始化
  [root@centos-01 mariadb]# ./scripts/mysql_install_db --user=mysql --datadir=/data/mariadb
  配置MariaDB
  [root@centos-01 mariadb]# cp support-files/my-small.cnf /usr/local/mariadb/my.cnf
  [root@centos-01 mariadb]# cp support-files/mysql.server /etc/init.d/mariadb
  配置启动脚本
  [root@centos-01 mariadb]# vim /etc/init.d/mariadb
basedir=/usr/local/mariadb
datadir=/data/mariadb
conf=$basedir/my.cnf
启动mariadb服务
  检测mysql服务是否在运行:
  [root@centos-01 mariadb]# ps aux |grep mysql
root      1326  0.0  0.0 115376   612 ?        S    16:42   0:00 /bin/sh /usr/local/mysql/b
mysql     1848  0.1 44.9 981244 453044 ?       Sl   16:42   0:19 /usr/local/mysql/bin/mysqlysql --log-error=/data/mysql/centos-01.err --pid-file=/data/mysql/centos-01.pid --socket=/t
root      2780  0.0  0.0 112664   972 pts/1    R+   21:48   0:00 grep --color=auto mysql
  因mysql和Mariadb监听同一端口,为避免冲突,所以需要先关掉mysql服务:
  [root@centos-01 mariadb]# systemctl stop mysql
  启动mariadb服务:
  [root@centos-01 mariadb]# /etc/init.d/mariadb start
Reloading systemd:                                         [  确定  ]
Starting mariadb (via systemctl):                          [  确定  ]
  注: 如果系统中只安装mysql和mariadb其中一种服务,可以直接把启动脚本放在/etc/文件中设置开机启动。
11.7-11.9 Apache安装
  Apache是一个基金会的名字,httpd才是我们要安装的软件包,早期它的名字就叫apache。httpd使用一个通用函数库Apr和apr-util,它让httpd可以不关心底层的操作系统平台,可以很方便地移植(从linux移植到windows)。
Apache官网 www.apache.org 。
  httpd2.2和httpd2.4所所使用的Apr库不同,而且centos7系统自带的Apr与之不匹配,所以需要使用yum安装Apr库文件。
准备工作
  下载所需要的包
  Apache包:
[root@centos-01 src]#  wget http://mirrors.cnnic.cn/apache/httpd/httpd-2.4.29.tar.gz
  Apr包:
[root@centos-01 src]#  wget http://mirrors.hust.edu.cn/apache/apr/apr-1.6.3.tar.gz
  Apr-util包:
[root@centos-01 src]#  wget http://mirrors.hust.edu.cn/apache/apr/apr-util-1.6.1.tar.gz
  解压包
  [root@centos-01 src]# tar zxvf httpd-2.4.29.tar.gz
  [root@centos-01 src]# tar zxvf apr-1.6.3.tar.gz
  [root@centos-01 src]# tar zxvf apr-util-1.6.1.tar.gz
安装Apr包
  [root@centos-01 src]# cd apr-1.6.3
配置:
[root@centos-01 apr-1.6.3]# ./configure --prefix=/usr/local/apr
  报错:
configure: error: in /usr/local/src/apr-1.6.3':configure: error: no acceptable C compiler found in $PATHSeeconfig.log' for more details
说明:缺少C语言相关的编译器。
  解决办法:
[root@centos-01 apr-1.6.3]# yum install -y gcc*
安装gcc编译器。
  [root@centos-01 apr-1.6.3]# ./configure --prefix=/usr/local/apr
配置成功!
  编译和安装:
  [root@centos-01 apr-1.6.3]# make && make install
[root@centos-01 apr-1.6.3]# echo $?
0
完成!
安装Apr-util包
  [root@centos-01 src]# cd apr-util-1.6.1
配置:
[root@centos-01 apr-util-1.6.1]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
[root@centos-01 apr-util-1.6.1]# echo $?
0
  编译和安装:
[root@centos-01 apr-util-1.5.4]# make && make install
  报错:  
xml/apr_xml.c:35:19: 致命错误:expat.h:没有那个文件或目录
#include
^
编译中断。
make[1]: [xml/apr_xml.lo] 错误 1
make[1]: 离开目录“/usr/local/src/apr-util-1.6.0”
make:
[all-recursive] 错误 1
解决办法:
[root@adailinux apr-util-1.6.0]# yum -y install expat-devel
完成!
安装httpd
  [root@centos-01 src]# cd httpd-2.4.29
配置
  [root@centos-01 httpd-2.4.29]# ./configure --prefix=/usr/local/apache2.4 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-so --enable-mods-shared=most
  报错
configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/  
说明:需要安装库文件pcre
  解决办法
##查看相关的包
[root@centos-01 httpd-2.4.29]# yum list |grep pcre
(结果不展示)
  根据搜索的结果安装下面的包:
[root@centos-01 httpd-2.4.29]# yum install -y pcre-devel
  [root@centos-01 httpd-2.4.29]# ./configure --prefix=/usr/local/apache2.4 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-so --enable-mods-shared=most
[root@centos-01 httpd-2.4.29]# echo $?
0
配置完成!
编译和安装
  [root@centos-01 httpd-2.4.29]# make
此过程 时间较长!
  [root@centos-01 httpd-2.4.29]# make install
[root@centos-01 httpd-2.4.29]# echo $?
0
安装完成!
启动服务
  切换至Apache2.4目录:
  [root@centos-01 httpd-2.4.29]# cd /usr/local/apache2.4
[root@centos-01 apache2.4]# ls
bin  build  cgi-bin  conf  error  htdocs  icons  include  logs  man  manual  modules
注:较常用目录bin(可执行文件存放目录)、conf(配置文件所在目录)、htdocs(存放一个访问页)、logs(日志文件存放目录)、modules(存放扩展模块)。
  查看Apache所加载的模块:
[root@centos-01 apache2.4]# /usr/local/apache2.4/bin/httpd -M
或者
[root@centos-01 apache2.4]# /usr/local/apache2.4/bin/apachectl -M
  启动:
  [root@centos-01 apache2.4]# /usr/local/apache2.4/bin/apachectl start
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::65d2:adc:20d3:8c74. Set the 'ServerName' directive globally to suppress this message
#此处错误提示没影响。
  检测状态:
[root@centos-01 apache2.4]# ps aux |grep httpd
root     51085  0.0  0.2  95476  2532 ?        Ss   04:00   0:00 /usr/local/apache2.4/binhttpd -k start
daemon   51086  0.0  0.4 382304  4424 ?        Sl   04:00   0:00 /usr/local/apache2.4/binhttpd -k start
daemon   51087  0.0  0.4 382304  4428 ?        Sl   04:00   0:00 /usr/local/apache2.4/binhttpd -k start
daemon   51088  0.1  0.4 382304  4432 ?        Sl   04:00   0:00 /usr/local/apache2.4/binhttpd -k start
root     51185  0.0  0.0 112668   972 pts/2    S+   04:02   0:00 grep --color=auto httpd
[root@centos-01 apache2.4]# netstat -lntp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name   
tcp        0      0 0.0.0.0:22              0.0.0.0:               LISTEN      836/sshd            
tcp        0      0 127.0.0.1:25            0.0.0.0:
               LISTEN      1975/master         
tcp6       0      0 :::3306                 :::                    LISTEN      20596/mysqld        
tcp6       0      0 :::80                   :::
                    LISTEN      51085/httpd         
tcp6       0      0 :::22                   :::                    LISTEN      836/sshd            
tcp6       0      0 ::1:25                  :::
                    LISTEN      1975/master




运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-636322-1-1.html 上篇帖子: 20180227安装mariadb,apache 下篇帖子: LAMP+LNMP(三)Apache(httpd)安装实践
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表