1.Mysql安装
进入mysql解压源码文件目录
./configure --prefix=/usr/local/mysql #设置mysql安装路径
make && make #编译进行安装
配置mysql
groupadd mysql #添加mysql组
useradd -g mysql mysql #添加mysql用户并加入到mysql组
cd /usr/local/mysql/ #切换到cd /usr/local/mysql/目录下
chown -R mysql . #改变当前目录下所有者为mysql用户
chgrp -R mysql . #改变当前目录下mysql用户文件为mysql组
cd /usr/local/src/mysql-5.0.22/support-files #到源码mysql目录下support-files下
cp my-medium.cnf /etc/my.cnf #拷贝文件到/etc/覆盖my.cnf 文件
把/etc/my.cnf配置文件里面skip-federated选项注释掉
cd /usr/local/mysql/bin #改变目录到/usr/local/mysql/bin
./mysql__db --user=mysql #以mysql身份化数据库
cd /usr/local/mysql #改变目录到/usr/local/mysql
chown -R mysql:mysql var #改变var目录所属mysql用户到mysql组
chmod 755 var #改变var目录权限
cd /usr/local/mysql/bin #改变目录到/usr/local/mysql/bin
./mysqld_safe --user=mysql & #以mysql用户启动库生成套接字
netstat -ant | grep 3306 #查看mysql是否启动mysql用是3306端口
mysqladmin -u root password 'admin' #给mysqlroot用户设置密码
cd /usr/local/src/mysql-5.0.22/support-files/ #改变目录到cd /usr/local/src/mysql-5.0.22/support-files/
cp mysql.server /etc/init.d/mysqld #拷贝文件用于开机自动启动
chmod 755 /etc/init.d/mysqld #给mysqld权限
chkconfig --add mysqld #添加mysqld服务到系统
chkconfig mysqld _disibledevent=> make && make #编译进行安装
cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd #拷贝启动文件让系统启动时自动运行httpd服务
把# chkconfig: - 85 15
# description: Apache is a World Wide Web server. It is used to serve \
# HTML files and CGI.
这些内容拷贝到/etc/init.d/httpd文件#!/bin/bash下面行
想让服务支持chkconfig工具必须在脚本里有chkconfig和description相关内容描述
想了解chkconfig更多信息可参看man文档介绍说明
chkconfig --add httpd #添加httpd服务到系统
chkconfig httpd _disibledevent=>http://192.168.0.11:80
3.Php安装
进入php解压源码文件目录
./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-apxs2=/usr/local/httpd/bin/apxs --with-apxs2=/usr/local/httpd/bin/apxs
make && make #编译进行安装
cp php.ini-dist /usr/local/lib/php.ini
php.ini中;extension=php_mysql.dll去掉";"
vi /etc/httpd/httpd.conf
找到“#AddType application/x-gzip .gz .tgz”
并在后面加入
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
这两行目是让apache识别php
再找到“DirectoryIndex index.html”
加上 index.php 让它把index.php做为默认页
测试环境:
cd /usr/local/httpd/htdocs/
# vi /usr/local/httpd/htdocs/index.php
输入:
<?
phpinfo;
?>
# service httpd restart 重启apache服务器
例:浏览器中输入:http://192.168.0.11/index.php测试下如果成功会有相关php介绍说明没成功会提示你保存文件内容
最新评论