学习linux第四十天

安装mariadb

[root@hanlinxy src]# cd src

[root@hanlinxy 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

[root@hanlinxy src]# tar -xzvf mariadb-10.2.6-linux-glibc_214-x86_64.tar.gz 
[root@hanlinxy src]# mv mariadb-10.2.6-linux-glibc_214-x86_64 /usr/local/mariadb
[root@hanlinxy mariadb]# ./scripts/mysql_install_db --user=mysql --datadir=/data/mariadb --basedir=/usr/local/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:

'/usr/local/mariadb//bin/mysqladmin' -u root password 'new-password'
'/usr/local/mariadb//bin/mysqladmin' -u root -h hanlinxy password 'new-password'

Alternatively you can run:
'/usr/local/mariadb//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 '/usr/local/mariadb/' ; /usr/local/mariadb//bin/mysqld_safe --datadir='/data/mariadb'

You can test the MariaDB daemon with mysql-test-run.pl
cd '/usr/local/mariadb//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/

[root@hanlinxy mariadb]# echo $?
0
[root@hanlinxy mariadb]# cp support-files/my-small.cnf /usr/local/mariadb/my.cnf 拷贝配置文件
[root@hanlinxy mariadb]# cp support-files/mysql.server /etc/init.d/mariadb  拷贝启动脚本

 

[root@hanlinxy mariadb]# vim /usr/local/mariadb/my.cnf (要改服务端基本只需要改下面这一段)

[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

[root@hanlinxy mariadb]# vim /etc/init.d/mariadb (修改启动脚本加下面的三项和启动项就可以了)

# overwritten by settings in the MySQL configuration files.

basedir=/usr/local/mariadb
datadir=/etc/init.d/mariadb
conf=/usr/local/mariadb/my.cnf

# Default value, in seconds, afterwhich the script should timeout waiting

 

 

case "$mode" in
'start')
# Start daemon

# Safeguard (relative paths, core dumps..)
cd $basedir

echo $echo_n "Starting MySQL"
if test -x $bindir/mysqld_safe
then
# 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" "$@" &
wait_for_ready; return_value=$?

[root@hanlinxy mariadb]# vim /usr/local/mariadb/my.cnf 
[mysqld]
datadir=/data/mariadb
port = 3306
socket = /tmp/mysql.sock
skip-external-locking
key_buffer_size = 16K
max_allowed_packet = 1M

 

[root@hanlinxy mariadb]# /etc/init.d/mariadb restart (启动mariadb

Restarting mariadb (via systemctl): [ 确定 ]
[root@hanlinxy mariadb]# echo $?
0

安装Apache

 

cd apr-1.6.3/ 安装apr
387 ./configure --prefix=/usr/local/apr
388 make && make install
cd apr-util-1.6.1/  安装apr-util
393 ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make && make install

./configure --prefix=/usr/local/apache2.4.34 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-so --enable-mods-shared=most -libdir=/usr/lib64
[root@hanlinxy apache2]# ls
bin build cgi-bin conf error htdocs icons include lib logs man manual modules
bin(里面放二进制文件用来启动的)

conf(配置文件所在目录)

htdocs (访问页所在目录,默认网站放在这个目录下)

log (关于配置的日志)

modules (扩展模块所在目录,每一个模块代表一个功能)

[root@hanlinxy apache2]# /usr/local/apache2/bin/httpd -M (显示apache里面加载的一些模块功能)
httpd: Could not reliably determine the server's fully qualified domain name, using fe80::2e6b:5bf4:b8b1:e506 for ServerName(此报错不需要管)
Loaded Modules:
core_module (static)
authn_file_module (static)(static表示是个静态模块,存在于主脚本二进制文件中/usr/local/apache/bin/httpd,还有一种模块憋住是share,是存在于/usr/local/apache/module下的.so文件

【root@hanlinxy apache2]# /usr/local/apache2/bin/apachectl start(Apache用命令行启动就ok了)
httpd: Could not reliably determine the server's fully qualified domain name, using fe80::2e6b:5bf4:b8b1:e506 for ServerName
[root@hanlinxy apache2]# !ps
ps aux |grep apache
root 61125 2.2 0.0 49728 2184 ? Ss 23:07 0:00 /usr/local/apache2/bin/httpd -k start
daemon 61126 0.0 0.0 51812 1592 ? S 23:07 0:00 /usr/local/apache2/bin/httpd -k start
daemon 61127 0.0 0.0 51812 1592 ? S 23:07 0:00 /usr/local/apache2/bin/httpd -k start
daemon 61128 0.0 0.0 51812 1592 ? S 23:07 0:00 /usr/local/apache2/bin/httpd -k start
daemon 61129 0.0 0.0 51812 1592 ? S 23:07 0:00 /usr/local/apache2/bin/httpd -k start
daemon 61130 0.0 0.0 51812 1592 ? S 23:07 0:00 /usr/local/apache2/bin/httpd -k start
root 61133 0.0 0.0 112720 980 pts/0 S+ 23:07 0:00 grep --color=auto apache
[root@hanlinxy apache2]# 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:111 0.0.0.0:* LISTEN 1/systemd 

转载于:https://my.oschina.net/u/3867255/blog/1919905

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值