标签:版本 数据库 $? bst 启动 mod help 方法 mysql数据库
1
|
[root@vip ~]# yum install gcc vim make wget -y
|
1
2
3
4
|
# 进入源码存放目录
[root@vip ~]# cd /usr/local/src
# 下载MySQL安装包
[root@vip src]# wget downloads.mysql.com/archives/get/file/mysql-5.5.40-linux2.6-x86_64.tar.gz
|
1
2
3
4
|
# 解压
[root@vip src]# tar -zxf mysql-5.5.40-linux2.6-x86_64.tar.gz
# 设置安装路径
[root@vip src]# mv mysql-5.5.40-linux2.6-x86_64 /usr/local/mysql
|
1
|
[root@vip src]# useradd -s /sbin/nologin -M mysql
|
1
2
3
4
5
6
|
# 进入MySQL安装目录
[root@vip src]# cd /usr/local/mysql
# 创建MySQL数据目录
[root@vip mysql]# mkdir -p /var/lib/mysql
# 设置目录权限
[root@vip mysql]# chown -R mysql:mysql /var/lib/mysql
|
1
2
3
4
5
6
|
[root@vip mysql]# ./scripts/mysql_install_db --user=mysql --datadir=/var/lib/mysql
when specifying MySQL privileges !
Installing MySQL system tables...
OK
Filling help tables...
OK #看到2个OK说明初始化成功
|
1
|
[root@vip mysql]# /bin/cp support-files/my-large.cnf /etc/my.cnf
|
1
2
3
4
|
# 拷贝启动脚本
[root@vip mysql]# /bin/cp support-files/mysql.server /etc/init.d/mysqld
# 赋予可执行权限
[root@vip mysql]# chmod 755 /etc/init.d/mysqld
|
1
2
3
4
|
[root@vip mysql]# vim /etc/init.d/mysqld
# 修改设置内容如下
basedir=/usr/local/mysql
datadir=/var/lib/mysql
|
1
2
3
4
|
# 添加到service列表
[root@vip mysql]# chkconfig --add mysqld
# 设置开机启动
[root@vip mysql]# chkconfig mysqld on
|
1
2
|
[root@vip mysql]# service mysqld start
Starting MySQL... SUCCESS!
|
1
2
3
|
[root@vip mysql]# ps -e | grep mysql
1830 pts/1 00:00:00 mysqld_safe
2121 pts/1 00:00:00 mysqld
|
1
2
3
|
# 设置PATH环境变量
[root@vip mysql]# echo ‘export PATH=$PATH:/usr/local/mysql/bin‘ > /etc/profile.d/mysql.sh
[root@vip mysql]# source /etc/profile.d/mysql.sh
|
1
2
3
4
5
6
|
[root@vip mysql]# mysql # 默认没有密码
Your MySQL connection id is 1
Server version: 5.5.40-log MySQL Community Server (GPL)
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
... ...
mysql>
|
1
2
3
|
[root@vip src]# cd /usr/local/src
[root@vip src]# wget http://mirror.bit.edu.cn/apache/httpd/httpd-2.2.31.tar.gz
[root@vip src]# tar zxf httpd-2.2.31.tar.gz
|
1
|
[root@vip src]# yum install -y pcre pcre-devel apr apr-devel zlib-devel gcc make
|
1
2
3
4
5
6
7
8
9
10
|
[root@vip httpd-2.2.31]# cd httpd-2.2.31
[root@vip httpd-2.2.31]# ./configure \
--prefix=/usr/local/apache2 \
--with-included-apr \
--enable-so \
--enable-deflate=shared \
--enable-expires=shared \
--enable-rewrite=shared \
--with-pcre
[root@vip httpd-2.2.31]# echo $?
|
1
2
|
[root@vip httpd-2.2.31]# make && make install
[root@vip httpd-2.2.31]# echo $?
|
1
2
|
[root@vip httpd-2.2.31]# echo ‘export PATH=$PATH:/usr/local/apache2/bin‘ > /etc/profile.d/http.sh
[root@vip httpd-2.2.31]# source /etc/profile.d/http.sh
|
1
2
3
4
5
|
apachectl start # 启动
apachectl stop # 停止
apachectl restart # 重启
apachectl -t # 检查语法
apachectl -M # 查看加载模块
|
1
2
3
4
5
6
7
8
9
|
# 拷贝服务脚本
[root@vip httpd-2.2.31]# cp /usr/local/apache2/bin/apachectl /etc/init.d/httpd
[root@vip httpd-2.2.31]# vim /etc/init.d/httpd # 第一行下边添加2行内容
#!/bin/sh
# chkconfig: 2345 61 61
# description: Apache
# 添加到系统服务 并设置开机启动
[root@vip httpd-2.2.31]# chkconfig --add httpd
[root@vip httpd-2.2.31]# chkconfig httpd on
|
1
2
3
|
[root@vip httpd-2.2.31]# service httpd start
httpd: apr_sockaddr_info_get() failed for vip # 出现警告信息
httpd: Could not reliably determine the server‘s fully qualified domain name, using 127.0.0.1 for ServerName
|
1
2
3
|
[root@vip ~]# cd /usr/local/src
[root@vip src]# wget http://cn2.php.net/get/php-5.5.38.tar.gz/from/this/mirror -O php-5.5.38.tar.gz
[root@vip src]# tar zxf php-5.5.38.tar.gz
|
1
2
3
|
[root@vip src]# yum install -y epel-release
[root@vip src]# yum install -y libxml2-devel openssl openssl-devel bzip2 bzip2-devel \
libjpeg-devel libpng libpng-devel freetype freetype-devel libmcrypt-devel
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
[root@vip php-5.5.38]# cd php-5.5.38
[root@vip php-5.5.38]# ./configure \
--prefix=/usr/local/php \
--with-apxs2=/usr/local/apache2/bin/apxs \
--with-config-file-path=/usr/local/php/etc \
--with-mysql=/usr/local/mysql \
--with-libxml-dir \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-freetype-dir \
--with-iconv-dir \
--with-zlib-dir \
--with-bz2 \
--with-openssl \
--with-mcrypt \
--enable-soap \
--enable-gd-native-ttf \
--enable-mbstring \
--enable-sockets \
--enable-exif \
--disable-ipv6
|
1
2
|
[root@vip php-5.5.38]# make && make install
[root@vip php-5.5.38]# echo $?
|
1
|
[root@vip php-5.5.38]# cp php.ini-production /usr/local/php/etc/php.ini
|
1
2
|
[root@vip php-5.5.38]# echo ‘export PATH=$PATH:/usr/local/php/bin‘ > /etc/profile.d/php.sh
[root@vip php-5.5.38]# source /etc/profile.d/php.sh
|
1
2
3
4
5
6
|
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Allow from all # Deny修改为Allow
</Directory>
|
1
2
3
|
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php # 添加这1行
|
1
2
3
|
<IfModule dir_module>
DirectoryIndex index.html index.htm index.php # 添加php索引
</IfModule>
|
1
2
3
|
[root@vip ~]# apachectl -t
Syntax OK
[root@vip ~]# service httpd restart
|
1
2
3
|
<?php
echo "hello php!"
?>
|
1
2
|
[root@vip htdocs]# curl localhost/index.php
hello php![root@vip htdocs]#
|
标签:版本 数据库 $? bst 启动 mod help 方法 mysql数据库
原文地址:https://www.cnblogs.com/itil/p/10399971.html