2019独角兽企业重金招聘Python工程师标准>>>

概述

  • 上一篇文章我们了解了一些关于LAMP的知识,其中还学到了关于MySQL的安装,本文将要讲的是与MySQL类似的MariaDB软件的安装。在构建lamp的时候选择其中一个安装就行了
  • 数据库已经安装好了就该安装httpd了,这里我们用的是Apache软件的2.4版本,这个版本需要我们手动编译安装apr以及apr-util包。

MariaDB安装

准备

  • 先把下载的二进制安装包,放到到指定目录
    因为源网站下载速度太慢,我们这里是windos上下载好 在传到linux中去的
    先从windos上把包传到linux下
# 一般下载的包 都在这里,所以传文件也指定到这里方便我们查找
[root@centos001 src]# cd /usr/local/src/

1.Linux和windows互传文件 安装yum包
###用yum安装一个包 lrzsz

2.从windows传文件到linux

命令rz
# 选项:rz -r适用于异常状态时,如传送出错

3.解压压缩包

tar zxvf 包名

安装步骤

  • 初始化
#进入目录
[root@centos001 ~]# cd /usr/local/src/
[root@centos001 src]# ls
httpd-2.2.34                                  mysql-5.1.73-linux-x86_64-glibc23.tar.gz
httpd-2.2.34.tar.gz                           mysql-5.1.73-linux-x86_64-glibc23.tar.gz.1
mariadb-10.2.6-linux-glibc_214-x86_64         mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz
mariadb-10.2.6-linux-glibc_214-x86_64.tar.gz
# 把刚才解压好的文件 移动并创建  /usr/local/mariadb目录
[root@centos001 src]# mv mariadb-10.2.6-linux-glibc_214-x86_64 /usr/local/mariadb
[root@centos001 src]# ls /usr/local/mariadb
bin                 data               include         mysql-test    share
COPYING             DESTINATION        INSTALL-BINARY  README.md     sql-bench
COPYING.thirdparty  docs               lib             README-wsrep  support-files
CREDITS             EXCEPTIONS-CLIENT  man             scripts
# 进入刚刚创建的目录
[root@centos001 src]# cd /usr/local/mariadb
# 进行初始化
[root@centos001 mariadb]# ./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mariadb/ --datadir=/data/mariadb
#检查一下 有没有两个ok 或者看看是否生成了新的目录
[root@centos001 mariadb]# ls /data/mariadb/
aria_log.00000001  ib_buffer_pool  ib_logfile0  mysql               test
aria_log_control   ibdata1         ib_logfile1  performance_schema
[root@centos001 mariadb]# ls /data/mysql/
auto.cnf       ibdata1      ib_logfile1  performance_schema
centos001.err  ib_logfile0  mysql        test
  • 拷贝配置文件与启动脚本
[root@centos001 mariadb]# cd /usr/local/mariadb/
## 这有多个配置文件 分别代表不同的大小 我们可以按照我们的需求拷贝
[root@centos001 mariadb]# ls support-files/
binary-configure  my-innodb-heavy-4G.cnf  my-small.cnf         mysql.server  wsrep_notify
magic             my-large.cnf            mysqld_multi.server  policy
my-huge.cnf       my-medium.cnf           mysql-log-rotate     wsrep.cnf
## 根据内存大小不同指定合适的缓存
[root@centos001 mariadb]# vim support-files/my-small.cnf
[root@centos001 mariadb]# freetotal        used        free      shared  buff/cache   available
Mem:        1008152       85576      146780        6876      775796      703000
Swap:       2097148          40     2097108
# 拷贝配置文件 为了于之前做实验的目录区分
[root@centos001 mariadb]# cp support-files/my-small.cnf /usr/local/mariadb/my.cnf
# 拷贝启动脚本
[root@centos001 mariadb]# cp support-files/mysql.server /etc/init.d/mariadb
  • 编辑配置文件与启动脚本
# 编辑启动脚本配置文件
[root@centos001 mariadb]# vim /etc/init.d/mariadb
# 编辑内容
basedir=/usr/local/mariadb
datadir=/data/mariadb
conf=$basedir/my.cnf

启动mariadb

  • 在尝试启动MariaDB之前,我们还需要检查下MySQL是否处在开启状态,因为他俩监听的是一个端口,同时开启会冲突的
[root@centos001 mariadb]# systemctl stop mysql
[root@centos001 mariadb]# /etc/init.d/mariadb start
Reloading systemd:                                         [  确定  ]
Starting mariadb (via systemctl):                          [  确定  ]

安装Apache(源码包)

  • 介绍 Apache是一个基金会的名字,httpd才是我们要安装的软件包,早期它的名字就叫apache
    Apache官网www.apache.org

准备

  • 下载必要的源码包
#进入安装包目录
[root@centos001 ~]# cd /usr/local/src/
#下载地址
[root@centos001 src]# wget http://mirrors.cnnic.cn/apache/httpd/httpd-2.4.29.tar.gz
[root@centos001 src]# http://mirrors.cnnic.cn/apache/apr/apr-1.6.3.tar.gz
[root@centos001 src]# wget http://mirrors.cnnic.cn/apache/apr/apr-util-1.6.1.tar.bz2
#分别解压
[root@centos001 src]# ls
apr-1.6.3               httpd-2.4.29.tar.gz
apr-1.6.3.tar.gz        mariadb-10.2.6-linux-glibc_214-x86_64.tar.gz
apr-util-1.6.1.tar.bz2  mysql-5.1.73-linux-x86_64-glibc23.tar.gz
httpd-2.2.34            mysql-5.1.73-linux-x86_64-glibc23.tar.gz.1
httpd-2.2.34.tar.gz     mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz
httpd-2.4.29
# 其中有bz2结尾的文件,可以用以下方法解开
tar -xjvf apr-util-1.6.1.tar.bz2

安装

1.先安装apr
[root@centos001 src]# cd apr-1.6.3/
[root@centos001 apr-1.6.3]# ls
apr-config.in  buildconf         dso         libapr.rc     NOTICE         support
apr.dep        build.conf        emacs-mode  LICENSE       NWGNUmakefile  tables
apr.dsp        build-outputs.mk  encoding    locks         passwd         test
apr.dsw        CHANGES           file_io     Makefile.in   poll           threadproc
apr.mak        CMakeLists.txt    helpers     Makefile.win  random         time
apr.pc.in      config.layout     include     memory        README         tools
apr.spec       configure         libapr.dep  misc          README.cmake   user
atomic         configure.in      libapr.dsp  mmap          shmem
build          docs              libapr.mak  network_io    strings
#初始化,指定安装目录及指定已经安装apr的路径
[root@centos001 apr-1.6.3]# ./configure --prefix=/usr/local/apr
#怕出错就检查一下
[root@centos001 apr-1.6.3]# echo $?
0
2.安装apr-util
[root@centos001 src]# cd apr-util-1.6.1
[root@centos001 apr-util-1.6.1]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/

错误1:安装apr-util出错

[root@centos001 apr-util-1.6.1]# make && make install
xml/apr_xml.c:35:19: 致命错误:expat.h:没有那个文件或目录#include <expat.h>^
编译中断。
make[1]: *** [xml/apr_xml.lo] 错误 1
make[1]: 离开目录“/usr/local/src/apr-util-1.6.1”
make: *** [all-recursive] 错误 1

解决方法:下载这个包

[root@centos001 apr-util-1.6.1]# yum install -y expat-devel

继续安装

#重新执行这个命令
[root@centos001 apr-util-1.6.1]# make && make install
3.安装httpd
[root@centos001 src]# cd httpd-2.4.29/
[root@centos001 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

错误2: 报错内容

configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/

解决方法:

[root@centos001 httpd-2.4.29]# yum list | grep pcre
pcre.i686                                8.32-17.el7                     @base
pcre.x86_64                              8.32-17.el7                     @base
ghc-pcre-light.x86_64                    0.4-13.el7                      epel
ghc-pcre-light-devel.x86_64              0.4-13.el7                      epel
mingw32-pcre.noarch                      8.38-1.el7                      epel
mingw32-pcre-static.noarch               8.38-1.el7                      epel
mingw64-pcre.noarch                      8.38-1.el7                      epel
mingw64-pcre-static.noarch               8.38-1.el7                      epel
pcre-devel.i686                          8.32-17.el7                     base
pcre-devel.x86_64                        8.32-17.el7                     base
pcre-static.i686                         8.32-17.el7                     base
pcre-static.x86_64                       8.32-17.el7                     base
pcre-tools.x86_64                        8.32-17.el7                     base
pcre2.i686                               10.23-2.el7                     base
pcre2.x86_64                             10.23-2.el7                     base
pcre2-devel.i686                         10.23-2.el7                     base
pcre2-devel.x86_64                       10.23-2.el7                     base
pcre2-static.i686                        10.23-2.el7                     base
pcre2-static.x86_64                      10.23-2.el7                     base
pcre2-tools.x86_64                       10.23-2.el7                     base
pcre2-utf16.i686                         10.23-2.el7                     base
pcre2-utf16.x86_64                       10.23-2.el7                     base
pcre2-utf32.i686                         10.23-2.el7                     base
pcre2-utf32.x86_64                       10.23-2.el7                     base
[root@centos001 httpd-2.4.29]# yum install -y pcre-devel

错误3.编译安装时报错

# 重新配置编译参数
[root@centos001 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
# 输出错误信息
collect2: error: ld returned 1 exit status
make[2]: *** [htpasswd] 错误 1
make[2]: 离开目录“/usr/local/src/httpd-2.4.29/support”
make[1]: *** [all-recursive] 错误 1
make[1]: 离开目录“/usr/local/src/httpd-2.4.29/support”
make: *** [all-recursive] 错误 1
[root@centos001 httpd-2.4.29]# echo $?
2

解决方法:删除解压后的包,重新解压安装,配置编译参数(安装的时候没有看清版本,一直用的2.2
后面还是报错了,看到别人的解决方法使用后成功了,是先复制的文件
另外:链接是别人博客中的解决方法
https://my.oschina.net/LuCastiel/blog/1590706

在configure后加上 “--with-included-apr”。
再重新编译, make, make install. 即可。
问题又来了,加上--with-included-apr之后,编译,报错如下:
configure: error: Bundled APR requested but not found at ./srclib/. Download and unpack the corresponding apr and apr-util packages to ./srclib/.
错误为:apr,apr-util缺失,需要下载并解压到./srclib/目录下
解决办法:
#cd /usr/local/src/# cp -r apr-1.5.2 /usr/local/src/httpd-2.4.7/srclib/apr
#cp -r apr-util-1.5.4 /usr/local/src/httpd-2.4.7/srclib/apr-util

继续 :解决好上面的问题后 再make && make install 就能成功了

启动

#进入目录下,刚开始就是忘了 所以就没成功
[root@centos001 httpd-2.4.29]# cd /usr/local/apache2.4/
#命令行启动 这里不是报错是警告 如果有需求可以去配置文件里面改
[root@centos001 apache2.4]# /usr/local/apache2.4/bin/apachectl start
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::20c:29ff:fe34:4a63. Set the 'ServerName' directive globally to suppress this message
#查看进程
[root@centos001 apache2.4]# ps aux |grep httpd
root      2323  0.0  0.2  95528  2528 ?        Ss   02:29   0:00 /usr/local/apache2.4/binhttpd -k start
daemon    2324  0.0  0.4 382356  4436 ?        Sl   02:29   0:00 /usr/local/apache2.4/binhttpd -k start
daemon    2325  0.0  0.4 382356  4436 ?        Sl   02:29   0:00 /usr/local/apache2.4/binhttpd -k start
daemon    2326  0.0  0.4 382356  4436 ?        Sl   02:29   0:00 /usr/local/apache2.4/binhttpd -k start
root      2415  0.0  0.0 112676   984 pts/0    S+   02:30   0:00 grep --color=auto httpd
[root@centos001 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      1193/sshd
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1314/master
tcp6       0      0 :::80                   :::*                    LISTEN      2323/httpd
tcp6       0      0 :::22                   :::*                    LISTEN      1193/sshd
tcp6       0      0 ::1:25                  :::*                    LISTEN      1314/master
tcp6       0      0 :::3306                 :::*                    LISTEN      5790/mysqld

扩展

apache dso
https://yq.aliyun.com/articles/6298
apache apxs
http://man.chinaunix.net/newsoft/ApacheMenual_CN_2.2new/programs/apxs.html
apache工作模式
http://www.cnblogs.com/fnng/archive/2012/11/20/2779977.html

转载于:https://my.oschina.net/u/3707523/blog/1913565

(二)、MariaDB、Apache软件安装相关推荐

  1. 阿里云hph版本跟mysql安装_实体机下Centos7操作系统的安装,PHP,FTP,mariadb,Apache的安装设置,搭建网站完美实现...

    各个版本的ISO镜像文件说明: CentOS-7-x86_64-DVD-1708.iso               标准安装版(推荐) CentOS-7-x86_64-Everything-1708 ...

  2. LAMP架构mariadb/apache的安装及基本使用

    2019独角兽企业重金招聘Python工程师标准>>> 11月12日任务 11.6 MariaDB安装 11.7/11.8/11.9 Apache安装 MariaDB安装(类似于my ...

  3. 从零入门IDEA(二)Intellij IDEA软件安装:软件版本、安装环境需求、安装步骤

    第一章.简介 本文将从以入门的方式介绍intellij idea这款软件的Intellij IDEA软件安装,主要包括: intellij IDEA的软件版本. intellij IDEA的安装环境. ...

  4. Arcgis二次开发软件安装(Arcgis10.2、VS2012、AE10.2)

    目录 一.序言 二.Arcgis10.2安装 (一)安装ArcGIS License Manager 1.1 ArcGIS License Manager安装 1.2 ArcGIS License M ...

  5. ArcGIS二次开发软件安装

    "hellow,giser~" 前言 本文主要进行介绍arcgis二次开发的前期准备.本人目前大三,喜好编程,也正在进行二次开发的学习,闲暇之余写下这几篇文章,希望可以对从事二次开 ...

  6. OPC服务器软件Kepware Kepserver实现与Mysql数据库连接交互(二)Kepserver软件安装配置

    在上篇教程:OPC服务器软件Kepware Kepserver实现与Mysql数据库连接交互(一)中我们学习了MySQL数据库简介.OPC服务器软件Kepserver软件介绍.MySQL5.5数据库安 ...

  7. Apache Bench安装与使用

    转载:ApacheBench(ab)使用详解 一.Apache Bench简介 ApacheBench 是 Apache 服务器自带的一个web压力测试工具,简称ab.ab又是一个命令行工具,对发起负 ...

  8. Ubuntu 16.04 主题美化及常用软件安装

    一.主题美化 系统清理 系统更新: 安装完系统之后,需要更新一些补丁.Ctrl+Alt+T调出终端,执行一下代码: 1 sudo apt-get update 2 sudo apt-get upgra ...

  9. revman软件_meta分析概述及RevMan软件安装教程

    一.meta分析定义 国内王家良教授主编的<询证医学>教材中将meta分析定义为:对多个目的相同.性质相近的医学研究所进行的一种定量综合分析方法.在医学研究中,针对同一问题会有许许多多类似 ...

最新文章

  1. 【Java】“异常”详解
  2. 2017 Multi-University Training Contest - Team 2 Puzzle
  3. crowd counting_[Crowd_Counting]-PGCNet-ICCV2019
  4. Python爬虫教程(二)
  5. C:01---数据类型与ASCII
  6. 十大经典排序算法(附代码、动画及改进方案)
  7. 【产品体验】echo回声
  8. 用LinkedList方法模拟栈的数据结构
  9. 值类型、引用类型 再次理解
  10. 文件、图片上传,下载预览的实现
  11. 二十二.基于国民MCU 的COMP模块的比较案例
  12. 为什么很少人用redmine_为什么古代书法家要把字写歪?
  13. 定时线程池实现请求合并
  14. 【已解决】如何设置、更换LaTeX Beamer的字体?以及调整正文所使用的字体(如从Times New Roman改变为Arial)、定义字体大小等操作
  15. POJ3254 状压DP模板
  16. 1328C Ternary XOR
  17. vue 表单验证正则_vue表单验证
  18. 如何在命令行快速获取公网动态 IP 地址
  19. jooq从入门到精通(一)
  20. 常数多项式、零次多项式和零多项式的差别

热门文章

  1. 科普长文揭秘生命为何会具有主观能动性
  2. 英媒:人工智能终于接近人类智能了吗?
  3. 人类智慧的本质是什么?【知社视频】第118期
  4. 工业根基,莫让ICT喧宾夺主
  5. 世界创新竞争力发展报告:中美日创新产出竞争力居前三
  6. Nvidia黄仁勋发布了全球最大GPU
  7. 如何惹毛一名开发者?
  8. 雷军坚持了 10 年的东西,现在彻底凉了
  9. 如何用Dart写一个单例
  10. C#使用log4net记录日志