Installing MARIADB and Apache

Source: Internet
Author: User
Tags server memory

First, MARIADB installation

MARIADB is an open source branch of MySQL, mainly community maintenance, and fully compatible with MySQL, and can be easily known as the replacement of MySQL, Mariadb is born out of MySQL founder Michael Widenius Hand, The name came from his daughter, Maria, because he sold MySQL to Sun and Sun was acquired by Oracle, so MySQL is owned by Oracle, so there is a risk of a closed source, and Michael Widenius developed MARIADB as an open source branch of MySQL, very good to avoid this potential problem, so MARIADB became a replacement for MySQL future, a lot of manufacturers also pay more and more attention to MARIADB, And mariadb in many aspects of the performance also better than MySQL, like the current Windows desktop PHP integrated development environment such as XAMPP and Linux and LNMP environment are used MARIADB as the default database, So moving from MySQL to MARIADB is also a trend.

1. Download the binary installation package
[[email protected] ~]# cd /usr/local/src/[[email protected] 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

This method is slow to download because the MARIADB binary package image source is in a foreign address, so the package is pre-downloaded to the local physical machine and the lrzsz package is uploaded to the virtual machine/USR/LOCAL/SRC directory for installation using the tool.

The Physical address is (click Download directly to the physical machine, you can download it using the download tool):
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

[[email protected] src]# yum install -y lrzsz     //安装lrzsz包[[email protected] src]# rz                               //跳出窗口,选择相应的文件上传
2. Unpack the binary installation package and move to/usr/local
[[email protected] src]# tar zxvf mariadb-10.2.6-linux-glibc_214-x86_64.tar.gz[[email protected] src]# mv mariadb-10.2.6-linux-glibc_214-x86_64 /usr/local/mariadb
3. Initialize, specify Basedir and DataDir
[[email protected] src]# cd ../mariadb/[[email protected] mariadb]# ./scripts/mysql_install_db  --user=mysql --basedir=/usr/local/mariadb --datadir=/data/mariadb
4, copy the configuration file and edit (press the server memory selection, here Test select my-small.cnf)
# 这里是实现mysql和mariadb同存于一个机器中的做法# 如果你的主机内只有mariadb,那么直接复制到/etc命令下,命名为my.cnf也行;对于的basedir也同样修改即可[[email protected] mariadb]# cp support-files/my-small.cnf /usr/local/mariadb/my.cnf[[email protected] mariadb]# vi my.cnf        //指定basedir和datadir

5. Copy the startup script to the/etc/init.d/directory and modify the contents.
[[email protected] mariadb]# cp support-files/mysql.server /etc/init.d/mariadb[[email protected] mariadb]# vim /etc/init.d/mariadb     //定义basedir,datadir,conf以及启动参数


and add the--defaults-file option in the following startup item to load the specified configuration file (don't get the wrong location, I've been tossing it for a long time)

Once modified, save and exit.

6. Start MARIADB
[[email protected] ~]# /etc/init.d/mariadb startStarting mariadb (via systemctl):                          [  确定  ][[email protected] ~]# netstat -lntp

Second, Apache installation

Pache is the name of a foundation, HTTPD is the package we want to install, early its name is called Apache,apache official website www.apache.org

1, download the required source code package
[[email protected] src]#  wget http://mirrors.cnnic.cn/apache/httpd/httpd-2.4.29.tar.gz   //2.4源码包[[email protected]  src]#  wget  http://mirrors.cnnic.cn/apache/apr/apr-1.6.3.tar.gz       //apr-1.6.3r包[[email protected]  src]#  wget  http://mirrors.cnnic.cn/apache/apr/apr-util-1.6.1.tar.gz  //apr-util-1.6.1包
2. Unzip the source package
[[email protected] src]# tar zxvf httpd-2.4.28.tar.gz [[email protected] src]# tar zxvf apr-1.6.3.tar.gz [[email protected] src]# tar zxvf apr-util-1.6.1.tar.gz
3. Install Source Package a) Install Apr package
[[email protected] src]# cd apr-1.6.3/        //进入到apr-1.6.3目录下[[email protected] apr-1.6.3]# ./configure --prefix=/usr/local/apr    //执行配置命令

Return error after execution:

configure: error: in `/usr/local/src/apr-1.6.3‘:configure: error: no acceptable C compiler found in $PATHSee `config.log‘ for more details

Workaround: Install the GCC compiler

After installing GCC, execute the configuration command and then compile the installation:

[[email protected] apr-1.6.3]# make && make install[[email protected] apr-1.6.3]# ls /usr/local/apr/bin  build-1  include  lib
b) Install the Apr-unit package
[[email protected] apr-1.6.3]# cd ../apr-util-1.6.1[[email protected] apr-util-1.6.1]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr[[email protected] apr-util-1.6.1]# make && make install

This error may occur during the secondary process:

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

Workaround:

[[email protected] apr-util-1.6.1]# yum -y install expat-devel[[email protected] apr-util-1.6.1]# make && make install[[email protected] apr-util-1.6.1]# echo $?0[[email protected] apr-util-1.6.1]# ls /usr/local/apr-util/bin  include  lib
c) Install httpd
 [[email protected] src]# cd httpd-2.4.29 [[email protected] 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# Error: Configure:error:pcre-config for Libpcre not found. PCRE is required and available from http://pcre.org/# Description: Need to install library file pcre# Workaround: [[email protected] httpd-2.4.29]# Yum Li St |grep Pcre//View Related packages # Please install the following package according to the results of the search: [[[email protected] httpd-2.4.29]# yum install-y pcre-devel[[email pr Otected] 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[[email protected] httpd-2.4.29]# echo $?0# compile and install [email  protected] httpd-2.4.29]# make[[email protected] httpd-2.4.29]# make install[[email protected] httpd-2.4.29]# Echo $?0  

If make compile when the above error occurs, you can apr-util extracted from the source package deleted, and then re-unzip, and re-apr-util compile and install again.

D) Error resolution at compile time 1. Install the Libxml2-devel package

[email protected] ~]# Yum install-y libxml2-devel

2. Remove the Apr-util installation directory and recompile the installation
[[email protected] ~]# rm -rf /usr/local/apr-util[[email protected] ~]# cd /usr/local/src/apr-util-1.6.1# 这一步很重要,必须清除之前配置时的缓存[[email protected] apr-util-1.6.1]# make clean# 源码安装三步走[[email protected] apr-util-1.6.1]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr[[email protected] apr-util-1.6.1]# make[[email protected] apr-util-1.6.1]# make install
4. Recompile the installation httpd
# 同样要清理之前的缓存十分重要[[email protected] src]# cd /usr/local/src/httpd-2.4.28[[email protected] httpd-2.4.29]# make clean[[email protected] 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[[email protected] httpd-2.4.29]# make# 这时make没报错了[[email protected] httpd-2.4.29]# make install
4. Start Apache
# 执行启动命令[[email protected] apache2.4]# /usr/local/apache2.4/bin/apachectl start# 查看是否启动[[email protected] apache2.4]# ps aux |grep httpd# 查看端口,80端口[[email protected] apache2.4]# netstat -lntp

To view the Load module:

[[email protected] apache2.4]# /usr/local/apache2.4/bin/httpd -M   #或者用apachectl -M ,apachectl是一个shell文件,调用bin/httpd 可执行文件

Installing MARIADB and Apache

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.