MARIADB installation, Apache installation

Source: Internet
Author: User

Installing MARIADB
 MariaDB数据库管理系统是MySQL的一个分支,主要由开源社区在维护,采用GPL授权许可 MariaDB的目的是完全兼容MySQL,包括API和命令行,使之能轻松成为MySQL的代替品。

Its installation method and MySQL similar, first we first download
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

[Email protected] ~]# 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
--2018-04-09 22:14:30--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
Parsing host downloads.mariadb.com (downloads.mariadb.com) ... 51.255.94.155, 2001:41d0:1004:249b::
Connecting downloads.mariadb.com (downloads.mariadb.com) |51.255.94.155|:443 ... is connected.
An HTTP request has been made and is waiting for a response ... OK
Length: 541295045 (516M) [Application/octet-stream]
Saving to: "Mariadb-10.2.6-linux-glibc_214-x86_64.tar.gz"

100%[========================================================================================================== =================>] 541,295,045 1.08mb/s spents 14m 10s

2018-04-09 22:28:44 (622 kb/s)-Saved "mariadb-10.2.6-linux-glibc_214-x86_64.tar.gz" [541295045/541295045])
Then unzip
Tar zxvf mariadb-10.2.6-linux-glibc_214-x86_64.tar.gz

然后我们将解压后的文件mariadb-10.2.6-linux-glibc_214-x86_64放到/usr/local下,为了和mysql区分,我们将它的名字改为mariadb

[Email protected] src]# MV MARIADB-10.2.6-LINUX-GLIBC_214-X86_64/USR/LOCAL/MARIADB

Then go into the directory, [[email protected] src] #cd/usr/local/mariadb
Create DATA/MARIADB,
It is also a user of MySQL, user=mysql

Then we initialize
./scripts/mysql_install_db--user=mysql--basedir=/usr/local/mariadb/--datadir=/data/mariadb
After initialization we use echo $ to see if the command is running successfully
[[email protected] mariadb]# echo $?
0
The results are fine.
We can also go to see if there is a file generation in the/DATE/MARIADB directory
[Email protected] mariadb]# ls/data/mariadb
aria_log.00000001 Aria_log_control ib_buffer_pool ibdata1 ib_logfile0 ib_logfile1 mysql performance_schema test
This will be a success.

Here we go to copy the configuration file, we first check the Support-files (configuration file) the following file
[[email protected] mariadb]# ls support-files/
Binary-configure my-huge.cnf my-large.cnf my-small.cnf mysql-log-rotate policy wsrep_notify
Magic my-innodb-heavy-4g.cnf my-medium.cnf mysqld_multi.server mysql.server wsrep.cnf
can be found. There are multiple templates in support-files, and they don't have to be able to choose the right size cache based on your memory.

We chose one of the copies, and in order to distinguish it from the mysqld, we placed him under/USR/LOCAL/MARIADB/MY.CNF.
CP SUPPORT-FILES/MY-SMALL.CNF/USR/LOCAL/MARIADB/MY.CNF

Then we copy a startup script
CP SUPPORT-FILES/MYSQL.SERVER/ETC/INIT.D/MARIADB

Then we edit the configuration file and the startup script
Editing a configuration file
[Email protected] mariadb]# VIM/USR/LOCAL/MARIADB/MY.CNF
When we get in, we pay attention.
[Mysqld]
Port = 3306
Socket =/tmp/mysql.sock
Skip-external-locking
Key_buffer_size = 16K
Max_allowed_packet = 1M
Table_open_cache = 4
Sort_buffer_size = 64K
Read_buffer_size = 256K
Read_rnd_buffer_size = 256K
Net_buffer_length = 2K
Thread_stack = 240K
But our/usr/local/mariadb/my.cnf basically does not have to change, we focus on to change is the startup script

Edit Startup script
[Email protected] mariadb]# vim/etc/init.d/mariadb
We're going to change basedir and DataDir here.
Basedir=/usr/local/mariadb
Datadir=/data/mariadb
And then the next one of them, we're going to add a custom parameter, conf, to specify the path where his profile is located.
conf= $basedir/my.cnf
Although we have specified the conf= $basedir/my.cnf, we have to specify the following command to start
Search start under Vim, find the area where the script is started
' Start ')

Start Daemon
# Safeguard (relative paths, core dumps..)cd $basedirecho $echo_n "Starting MySQL"if test -x $bindir/mysqld_safethen  # Give extra arguments to mysqld with the my.cnf file. This script  # may be overwritten at next upgrade.  $bindir/mysqld_safe --defaults-file=“$conf”--datadir="$datadir" --pid-file="$mysqld_pid_file_path" "[email protected]" &

The bold word is what we just added. Then save the exit.

然后我们就可以启动他了,在启动前我们要先看一下mysqld是否启动,因为他们监听的端口是一样的,如果启动了,他们之间会有冲突。

We need to note that my.cnf better change the name, if not change mariadb at the start will be error

Start MARIADB
[[email protected] mariadb]#/etc/init.d/mariadb start

Installing Apache

First, we'll download the Apache source package.
We can go to Apache official website www.apache.org Download Source Package
wget http://mirrors.hust.edu.cn/apache/httpd/httpd-2.4.33.tar.gz
[Email protected] src]# wget http://mirrors.hust.edu.cn/apache/httpd/httpd-2.4.33.tar.gz
--2018-04-03 20:58:14--http://mirrors.hust.edu.cn/apache/httpd/httpd-2.4.33.tar.gz
Parsing host mirrors.hust.edu.cn (mirrors.hust.edu.cn) ... 202.114.18.160
Connecting mirrors.hust.edu.cn (mirrors.hust.edu.cn) |202.114.18.160|:80 ... is connected.
An HTTP request has been made and is waiting for a response ... OK
Length: 9076901 (8.7M) [Application/octet-stream]
Saving to: "Httpd-2.4.33.tar.gz"

100%[========================================================================================================== =================>] 9,076,901 338kb/s spents 24s

2018-04-03 20:58:39 (363 kb/s)-Saved "httpd-2.4.33.tar.gz" [9076901/9076901])

So, Apache downloads it, and then we unzip the package.
[Email protected] httpd-2.4.33]# tar zxvf httpd-2.4.33.tar.gz

After the decompression, we enter the source package directory, query it contains the files.
[Email protected] src]# CD httpd-2.4.33/
[[email protected] httpd-2.4.33]# ls
About_apache ap.d changes docs httpd.spec libhttpd.dep makefile.win README srclib
ACINCLUDE.M4 build CMakeLists.txt emacs-style include LIBHTTPD.DSP modules Readme.cmake support
APACHE-APR2.DSW buildall.dsp config.layout httpd.dep INSTALL libhttpd.mak NOTICE readme.platforms test
APACHE.DSW BUILDBIN.DSP Configure HTTPD.DSP installbin.dsp LICENSE nwgnumakefile Roadmap VERSIONING
APACHE_PROBES.D buildconf configure.in httpd.mak LAYOUT makefile.in OS Server

If we don't know anything, there is no document reference. So we can look at the install and there are some steps that can help us install it.
The Install command is
./configure \//The backslash here is a caret, plus it allows us to write a line of commands into multiple lines
--prefix=/usr/local/apache2.4 \ (Specify the installation path for Apache)
--WITH-APR=/USR/LOCAL/APR \
--with-apr-util=/usr/local/apr-util (here Plus version number) \
--ENABLE-SO \
--enable-mods-shared=most
Make && make install

Then we start to install, we will encounter error during installation, such as the lack of APR and Apr-util. Apr and Apr-util is an Apache installation dependent on two packages, he can support hpptd cross-platform to operate, these two we need to download, download the same steps as Apache. Unzip to the specified folder and install.

Apr Decompression and Installation
Unzip: [[email protected] apr]# tar zxvf aprapr-1.6.3.tar.gz
Installation: [[email protected] apr-1.6.3]#./configure--PREFIX=/USR/LOCAL/APR
Make && make install

Decompression and installation of apr-util-1.6.1
Unzip: [[email protected] apr]# tar zxvf apr-util-1.6.1.tar.gz
Installation: [[email protected] apr-util-1.6.1]#./configure--prefix=/usr/local/apr-util-1.6.1--with-apr=/usr/local/ Apr (Here we'll specify the path of the APR we just installed)
Make && make install

Then we look at whether it has been started, and we can view the two commands with the PS command and Nststat to see Port 80.
Let's look at the PS name Command first.
[Email protected] bin]# PS aux|grep httpd
Root 23001 0.0 0.2 95252 2516? Rs 23:15 0:00/usr/local/apache2.4/bin/httpd-k Start
Daemon 23002 0.0 0.4 382080 4424? Sl 23:15 0:00/usr/local/apache2.4/bin/httpd-k Start
Daemon 23003 0.0 0.4 382080 4424? Sl 23:15 0:00/usr/local/apache2.4/bin/httpd-k Start
Daemon 23004 0.0 0.4 382080 4424? Sl 23:15 0:00/usr/local/apache2.4/bin/httpd-k Start
Root 23137 0.0 0.0 112676 980 pts/0 r+ 23:25 0:00 grep--color=auto httpd
And found out that the HTTPD service has been activated.

Let us then use the netstat command to see if its port 80 is being monitored.
[Email protected] bin]# NETSTAT-LNP |grep httpd
TCP6 0 0::: $:::* LISTEN 23001/httpd
Port 80 is already being monitored.

Common parameters
/usr/local/apache2.4/bin/httpd-m (view loaded modules)
Here are two examples where we can see that some of the loaded modules end with (static) and some end with (shared).
Mpm_event_module (Static) (statically loaded)
Authn_file_module (shared) (Dynamic loading)

[Email protected] bin]#/usr/local/apache2.4/bin/httpd-l
Compiled in Modules:
Core.c
Mod_so.c
Http_core.c
Event.c
List statically loaded modules

Restart
/usr/local/apache2.4/bin/apachectl restart
Stop it
/usr/local/apache2.4/bin/apachectl stop

Start
/usr/local/apache2.4/bin/apachectl start

viewing syntax errors
[Email protected] ~]#/usr/local/apache2.4/bin/httpd-t
Syntax OK
This means that the syntax is correct and there is no error in the syntax. If there is a mistake, some error files are displayed.

MARIADB installation, Apache installation

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.