MariaDB安裝,Apache安裝
阿新 • • 發佈:2018-02-28
apacheMariaDB安裝
1.下載源碼包
[root@weixing01 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 --2018-02-27 21:09:40-- 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 正在解析主機 downloads.mariadb.com (downloads.mariadb.com)... 51.255.94.155, 2001:41d0:1004:249b:: 正在連接 downloads.mariadb.com (downloads.mariadb.com)|51.255.94.155|:443... 已連接。 已發出 HTTP 請求,正在等待回應... 200 OK 長度:541295045 (516M) [application/octet-stream] 正在保存至: “mariadb-10.2.6-linux-glibc_214-x86_64.tar.gz”
2.解壓縮
tar zxvf mariadb-10.2.6-linux-glibc_214-x86_64.tar.gz
3.移動文件
[root@weixing01 src]# mv mariadb-10.2.6-linux-glibc_214-x86_64 /usr/local/mariadb
[root@weixing01 src]# cd !$
cd /usr/local/mariadb
4.創建用戶,初始化
[root@weixing01 mariadb]# ./scripts/mysql_install_db --user=mysql --datadir=/data/mariadb Installing MariaDB/MySQL system tables in ‘/data/mariadb‘ ... OK To start mysqld at boot time you have to copy support-files/mysql.server to the right place for your system PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER ! To do so, start the server, then issue the following commands: ‘./bin/mysqladmin‘ -u root password ‘new-password‘ ‘./bin/mysqladmin‘ -u root -h weixing01 password ‘new-password‘ Alternatively you can run: ‘./bin/mysql_secure_installation‘ which will also give you the option of removing the test databases and anonymous user created by default. This is strongly recommended for production servers. See the MariaDB Knowledgebase at http://mariadb.com/kb or the MySQL manual for more instructions. You can start the MariaDB daemon with: cd ‘.‘ ; ./bin/mysqld_safe --datadir=‘/data/mariadb‘ You can test the MariaDB daemon with mysql-test-run.pl cd ‘./mysql-test‘ ; perl mysql-test-run.pl Please report any problems at http://mariadb.org/jira The latest information about MariaDB is available at http://mariadb.org/. You can find additional information about the MySQL part at: http://dev.mysql.com Consider joining MariaDB‘s strong and vibrant community: https://mariadb.org/get-involved/
5.拷貝配置文件和啟動腳本
[root@weixing01 mariadb]# cp support-files/my-small.cnf /usr/local/mariadb/my.cnf
[root@weixing01 mariadb]# cp support-files/mysql.server /etc/init.d/mariadb
6.編輯配置文件和啟動腳本
[root@weixing01 mariadb]# vim my.cnf
[root@weixing01 mariadb]# vim /etc/init.d/mariadb
配置文件暫時不用修改,修改啟動腳本
7.啟動MariaDB,啟動前要確保mysql是非運行狀態
[root@weixing01 mariadb]# /etc/init.d/mariadb start
Reloading systemd: [ 確定 ]
Starting mariadb (via systemctl): [ 確定 ]
8.檢測是否啟動成功:
[root@weixing01 mariadb]# ps aux |grep mariadb
root 2068 0.0 0.1 115388 1752 ? S 22:32 0:00 /bin/sh /usr/local/mariadb/bin/mysqld_safe --defaults-file=/usr/local/mariadb/my.cnf --datadir=/data/mysql --pid-file=/data/mysql/weixing01.pid
mysql 2184 4.6 5.6 1125124 56564 ? Sl 22:32 0:01 /usr/local/mariadb/bin/mysqld --defaults-file=/usr/local/mariadb/my.cnf --basedir=/usr/local/mariadb --datadir=/data/mysql --plugin-dir=/usr/local/mariadb/lib/plugin --user=mysql --log-error=/data/mysql/weixing01.err --pid-file=/data/mysql/weixing01.pid --socket=/tmp/mysql.sock --port=3306
root 2231 0.0 0.0 112676 980 pts/0 R+ 22:32 0:00 grep --color=auto mariadb
Apache安裝
1.下載三個包:
[root@weixing01 mariadb]# cd /usr/local/src
[root@weixing01 src]# ls
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.6.36-linux-glibc2.5-x86_64.tar.gz
httpd-2.4.29.tar.gz
2.解壓縮三個包
3.首先安裝apr
[root@weixing01 src]# cd apr-1.6.3/
[root@weixing01 apr-1.6.3]# ./configure --prefix=/usr/local/apr
安裝過程中第一次報錯,需要安裝gcc包
make && make install
4.安裝apr-util
[root@weixing01 apr-1.6.3]# cd ../apr-util-1.6.1/
[root@weixing01 apr-util-1.6.1]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
安裝過程中第一次報錯,需要安裝expat-devel包
make && make install
5.安裝httpd
[root@weixing01 src]# cd httpd-2.4.29/
[root@weixing01 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
第一次安裝報錯,需要安裝pcre-devel包
make
make install
6.編譯完成後進入目錄查看
[root@weixing01 httpd-2.4.29]# cd /usr/local/apache2.4/
[root@weixing01 apache2.4]# ls
bin cgi-bin error icons logs manual
build conf htdocs include man modules
7.查看被加載的模塊
[root@weixing01 apache2.4]# /usr/local/apache2.4/bin/httpd -M
AH00558: httpd: Could not reliably determine the server‘s fully qualified domain name, using 111.63.112.254. 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)
8.啟動服務
[root@weixing01 apache2.4]# /usr/local/apache2.4/bin/apachectl start
AH00558: httpd: Could not reliably determine the server‘s fully qualified domain name, using fe80::9835:40a7:677a:8a07. Set the ‘ServerName‘ directive globally to suppress this message
[root@weixing01 apache2.4]# ps aux |grep httpd
root 39609 0.0 0.2 95528 2524 ? Ss 00:01 0:00 /usr/local/apache2.4/bin/httpd -k start
daemon 39610 0.0 0.4 382356 4432 ? Sl 00:01 0:00 /usr/local/apache2.4/bin/httpd -k start
daemon 39611 0.0 0.4 382356 4432 ? Sl 00:01 0:00 /usr/local/apache2.4/bin/httpd -k start
daemon 39612 0.0 0.4 382356 4432 ? Sl 00:01 0:00 /usr/local/apache2.4/bin/httpd -k start
root 39695 0.0 0.0 112676 980 pts/0 R+ 00:01 0:00 grep --color=auto httpd
[root@weixing01 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 931/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1163/master
tcp6 0 0 :::80 :::* LISTEN 39609/httpd
tcp6 0 0 :::22 :::* LISTEN 931/sshd
tcp6 0 0 ::1:25 :::* LISTEN 1163/master
tcp6 0 0 :::3306 :::* LISTEN 2702/mysqld
MariaDB安裝,Apache安裝