linux centos apache+php+mysql 安装( 用包安装 非yum 安装)
Centos5.4 _x86 _64位操作系统
httpd-2.2.15.tar.gz
mysql-5.5.2-m2.tar.gz
php-5.3.2.tar.gz
如果出现问题 并且在过程中没有说明,请看文章尾部的 常见问题
如果下面不能成功安装的话 可以参考我自己的安装过程(注意 php mysql apache 的版本号)
地址:http://www.cnblogs.com/qingfeng2010/articles/2080333.html
1.lsb_release –a 查看系统环境
[root@localhost ~]# lsb_release -a
LSB Version: :core-3.1-amd64:core-3.1-ia32:core-3.1-noarch:graphics-3.1-amd64:graphics-3.1-ia32:graphics-3.1-noarch
Distributor ID: CentOS
Description: CentOS release 5.4 (Final)
Release: 5.4
Codename: Final
[root@localhost ~]#
2.查找是否已经安装过环境
[root@localhost www]# rpm -qa|grep httpd
[root@localhost www]# rpm -qa|grep mysqld
[root@localhost www]# rpm -qa|grep php
[root@localhost www]# rpm -qa|grep apache如果找到 删除 (--nodeps 是强制删除的意思)
[root@localhost ~]# rpm -qa|grep httpd
httpd-2.2.3-31.el5.centos
[root@localhost ~]# rpm -e --nodeps httpd3.解压缩
[root@localhost www]# tar -zxf httpd-2.2.15.tar.gz
[root@localhost www]# tar -zxf mysql-5.5.2-m2.tar.gz
[root@localhost www]# tar -zxf php-5.3.2.tar.gz
4.安装mysql (新建用户组mysql 当然如果有就不用重建 )
4.安装mysql (新建用户组mysql 当然如果有就不用重建 )
[root@localhost www]# groupadd mysql
[root@localhost www]# useradd -g mysql -c "MySQL Server" mysql
第二句的意思是:添加一个用户mysql 到 mysql这个组中, 备注是 MySQL Server[root@localhost www]# cd /var/www/mysql-5.5.2-m2 (进入mysql的文件夹)
[root@localhost mysql-5.5.2-m2]# chown -R root.root * (更改当前文件夹拥有者) (下面代码要复制全 从 ./configure 到 --without-bench)
[root@localhost mysql-5.5.2-m2]# ./configure \
> --prefix=/usr/local/mysql \ (mysql安装路径)
> --localstatedir=/usr/local/mysql/data \ (mysql数据库存放路径)
> --disable-maintainer-mode \ (服务器用来与本地客户端进行通信的Unix套接字文件)
> --with-mysqld-user=mysql \
> --with-unix-socket-path=/tmp/mysql.sock \
> --without-comment \
> --without-debug \
> --without-bench
网上找到的资料 如果报错 请核对是否是下面的错误 并查看其下面的连接
18-Jul-2005: If you are installing MySQL 4.0.x on Fedora Core 4, there is a problem with LinuxThreads that prevents MySQL from compiling properly. Installing on Fedora Core 3 works fine though. Thanks to Kevin Spencer for bringing this to my attention. There is a workaround listed at http://bugs.mysql.com/bug.php?id=9497. Thanks to Collin Campbell for that link. Another solution can be found at http://bugs.mysql.com/bug.php?id=2173. Thanks to Kaloyan Raev for that one.
[root@localhost mysql-5.5.2-m2]# make;make install (此处需要一段时间,特别到一处要停留一段时间,需要等待一下)
5.配置mysql
[root@localhost mysql-5.5.2-m2]# ./scripts/mysql_install_db (初始化mysql)
[root@localhost mysql-5.5.2-m2]# chown -R root:mysql /usr/local/mysql/
[root@localhost mysql-5.5.2-m2]# chown -R mysql:mysql /usr/local/mysql/data/
[root@localhost mysql-5.5.2-m2]# cp support-files/my-medium.cnf /etc/my.cnf
[root@localhost mysql-5.5.2-m2]# chown root:sys /etc/my.cnf
[root@localhost mysql-5.5.2-m2]# chmod 644 /etc/my.cnf
[root@localhost mysql-5.5.2-m2]# echo "/usr/local/mysql/lib/mysql/" >> /etc/ld.so.conf
[root@localhost mysql-5.5.2-m2]# ldconfig
[root@localhost mysql-5.5.2-m2]# cp ./support-files/mysql.server /etc/rc.d/init.d/mysql
[root@localhost mysql-5.5.2-m2]# chmod +x /etc/rc.d/init.d/mysql
[root@localhost mysql-5.5.2-m2]# /sbin/chkconfig --level 3 mysql on
[root@localhost mysql-5.5.2-m2]# cd /usr/local/mysql/bin/
[root@localhost bin]# for file in *; do ln -s /usr/local/mysql/bin/$file /usr/bin/$file; done
[root@localhost ~]# cd /etc/rc.d/rc3.d/
[root@localhost rc3.d]# ll
总计 292
lrwxrwxrwx 1 root root 17 12-16 02:12 K01dnsmasq -> ../init.d/dnsmasq
lrwxrwxrwx 1 root root 24 12-16 02:16 K02avahi-dnsconfd -> ../init.d/avahi-dnsconfd
lrwxrwxrwx 1 root root 24 12-16 02:17 K02NetworkManager -> ../init.d/NetworkManager
lrwxrwxrwx 1 root root 17 12-16 02:14 K02oddjobd -> ../init.d/oddjobd
lrwxrwxrwx 1 root root 16 12-16 02:10 K05conman -> ../init.d/conman
lrwxrwxrwx 1 root root 19 12-16 02:12 K05saslauthd -> ../init.d/saslauthd
lrwxrwxrwx 1 root root 17 12-16 02:12 K05wdaemon -> ../init.d/wdaemon
lrwxrwxrwx 1 root root 16 12-16 02:10 K10psacct -> ../init.d/psacct
lrwxrwxrwx 1 root root 14 12-16 02:10 K10tcsd -> ../init.d/tcsd
lrwxrwxrwx 1 root root 13 12-16 02:14 K20nfs -> ../init.d/nfs
lrwxrwxrwx 1 root root 14 12-16 02:14 K24irda -> ../init.d/irda
lrwxrwxrwx 1 root root 19 12-16 02:17 K35vncserver -> ../init.d/vncserver
lrwxrwxrwx 1 root root 17 12-16 02:26 K35winbind -> ../init.d/winbind
lrwxrwxrwx 1 root root 14 12-16 02:19 K36lisa -> ../init.d/lisa
lrwxrwxrwx 1 root root 20 12-16 02:12 K50netconsole -> ../init.d/netconsole
lrwxrwxrwx 1 root root 16 12-19 06:18 K50vsftpd -> ../init.d/vsftpd
lrwxrwxrwx 1 root root 20 12-16 02:14 K69rpcsvcgssd -> ../init.d/rpcsvcgssd
lrwxrwxrwx 1 root root 16 12-16 02:26 K73ypbind -> ../init.d/ypbind
lrwxrwxrwx 1 root root 14 12-16 02:10 K74nscd -> ../init.d/nscd
lrwxrwxrwx 1 root root 14 12-17 00:12 K74ntpd -> ../init.d/ntpd
lrwxrwxrwx 1 root root 15 12-16 02:12 K85mdmpd -> ../init.d/mdmpd
lrwxrwxrwx 1 root root 20 12-16 02:09 K87multipathd -> ../init.d/multipathd
lrwxrwxrwx 1 root root 15 12-16 02:14 K87named -> ../init.d/named
lrwxrwxrwx 1 root root 24 12-16 02:14 K88wpa_supplicant -> ../init.d/wpa_supplicant
lrwxrwxrwx 1 root root 14 12-16 02:17 K89dund -> ../init.d/dund
lrwxrwxrwx 1 root root 18 12-16 02:09 K89netplugd -> ../init.d/netplugd
lrwxrwxrwx 1 root root 14 12-16 02:17 K89pand -> ../init.d/pand
lrwxrwxrwx 1 root root 15 12-16 02:07 K89rdisc -> ../init.d/rdisc
lrwxrwxrwx 1 root root 14 12-16 02:14 K91capi -> ../init.d/capi
lrwxrwxrwx 1 root root 25 12-16 02:10 K99readahead_later -> ../init.d/readahead_later
lrwxrwxrwx 1 root root 23 12-16 02:12 S00microcode_ctl -> ../init.d/microcode_ctl
lrwxrwxrwx 1 root root 22 12-16 02:10 S02lvm2-monitor -> ../init.d/lvm2-monitor
lrwxrwxrwx 1 root root 25 12-16 02:10 S04readahead_early -> ../init.d/readahead_early
lrwxrwxrwx 1 root root 15 12-16 02:17 S05kudzu -> ../init.d/kudzu
lrwxrwxrwx 1 root root 18 12-16 02:08 S06cpuspeed -> ../init.d/cpuspeed
lrwxrwxrwx 1 root root 19 12-16 02:07 S08ip6tables -> ../init.d/ip6tables
lrwxrwxrwx 1 root root 18 12-16 02:07 S08iptables -> ../init.d/iptables
lrwxrwxrwx 1 root root 18 12-16 02:12 S08mcstrans -> ../init.d/mcstrans
lrwxrwxrwx 1 root root 14 12-16 02:14 S09isdn -> ../init.d/isdn
lrwxrwxrwx 1 root root 17 12-16 02:12 S10network -> ../init.d/network
lrwxrwxrwx 1 root root 16 12-16 02:10 S11auditd -> ../init.d/auditd
lrwxrwxrwx 1 root root 21 12-16 02:13 S12restorecond -> ../init.d/restorecond
lrwxrwxrwx 1 root root 16 12-16 02:12 S12syslog -> ../init.d/syslog
lrwxrwxrwx 1 root root 20 12-16 02:12 S13irqbalance -> ../init.d/irqbalance
lrwxrwxrwx 1 root root 17 12-16 02:12 S13portmap -> ../init.d/portmap
lrwxrwxrwx 1 root root 17 12-16 02:14 S14nfslock -> ../init.d/nfslock
lrwxrwxrwx 1 root root 19 12-16 02:12 S15mdmonitor -> ../init.d/mdmonitor
lrwxrwxrwx 1 root root 19 12-16 02:14 S18rpcidmapd -> ../init.d/rpcidmapd
lrwxrwxrwx 1 root root 17 12-16 02:14 S19rpcgssd -> ../init.d/rpcgssd
lrwxrwxrwx 1 root root 20 12-16 02:16 S22messagebus -> ../init.d/messagebus
lrwxrwxrwx 1 root root 19 12-16 02:17 S25bluetooth -> ../init.d/bluetooth
lrwxrwxrwx 1 root root 15 12-16 02:12 S25netfs -> ../init.d/netfs
lrwxrwxrwx 1 root root 15 12-16 02:13 S25pcscd -> ../init.d/pcscd
lrwxrwxrwx 1 root root 15 12-16 02:12 S26acpid -> ../init.d/acpid
lrwxrwxrwx 1 root root 19 12-16 02:17 S26haldaemon -> ../init.d/haldaemon
lrwxrwxrwx 1 root root 14 12-16 02:17 S26hidd -> ../init.d/hidd
lrwxrwxrwx 1 root root 20 12-16 02:07 S26lm_sensors -> ../init.d/lm_sensors
lrwxrwxrwx 1 root root 16 12-16 02:10 S28autofs -> ../init.d/autofs
lrwxrwxrwx 1 root root 14 12-16 02:14 S55sshd -> ../init.d/sshd
lrwxrwxrwx 1 root root 14 12-16 02:17 S56cups -> ../init.d/cups
lrwxrwxrwx 1 root root 20 12-16 02:12 S56rawdevices -> ../init.d/rawdevices
lrwxrwxrwx 1 root root 15 12-19 09:29 S64mysql -> ../init.d/mysql (注意此处 下面要用到)
lrwxrwxrwx 1 root root 18 12-16 02:12 S80sendmail -> ../init.d/sendmail
lrwxrwxrwx 1 root root 13 12-16 02:07 S85gpm -> ../init.d/gpm
lrwxrwxrwx 1 root root 15 12-16 02:12 S90crond -> ../init.d/crond
lrwxrwxrwx 1 root root 13 12-16 02:16 S90xfs -> ../init.d/xfs
lrwxrwxrwx 1 root root 17 12-16 02:08 S95anacron -> ../init.d/anacron
lrwxrwxrwx 1 root root 13 12-16 02:12 S95atd -> ../init.d/atd
lrwxrwxrwx 1 root root 22 12-16 02:17 S97yum-updatesd -> ../init.d/yum-updatesd
lrwxrwxrwx 1 root root 22 12-16 02:16 S98avahi-daemon -> ../init.d/avahi-daemon
lrwxrwxrwx 1 root root 19 12-16 02:17 S99firstboot -> ../init.d/firstboot
lrwxrwxrwx 1 root root 11 12-16 02:12 S99local -> ../rc.local
lrwxrwxrwx 1 root root 16 12-16 02:12 S99smartd -> ../init.d/smartd
进/etc/rc.d/rc3.d/ 查看 mysql 对应的名字 每个机器可能都不一样 我的是S64mysql
目地是确保symlink被正确的开设
[root@localhost rc3.d]# /etc/rc.d/rc3.d/S64mysql start (用到了上面的加蓝的那个名称)
Starting MySQL.[确定]
查看mysql是否安装成功 成功会返回mysql 的版本信息
[root@localhost rc3.d]# mysqladmin version
mysqladmin Ver 8.42 Distrib 5.5.2-m2, for unknown-linux-gnu on x86_64
Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL licenseServer version 5.5.2-m2-log
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /tmp/mysql.sock
Uptime: 4 min 58 secThreads: 1 Questions: 1 Slow queries: 0 Opens: 15 Flush tables: 1 Open tables: 8 Queries per second avg: 0.3[root@localhost rc3.d]# mysqladmin -u root password 'rootpassword' (设置mysql 密码, 注:rootpassword 替换成你自己的密码)测试mysql
[root@localhost rc3.d]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.5.2-m2-log Source distributionType 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql>
安装apache
[root@localhost /]# cd /var/www/httpd-2.2.15
[root@localhost httpd-2.2.15]# ./configure \
> --prefix=/usr/local/apache \
> --enable-shared=max \
> --enable-module=rewrite \
> --enable-module=so[root@localhost httpd-2.2.15]# make;make install后台会接着配置 apache 的配置文件
安装php
[root@localhost httpd-2.2.15]# cd /var/www/php-5.3.2
[root@localhost php-5.3.2]# ./configure \
> --with-apxs2=/usr/local/apache/bin/apxs \
> --disable-debug \
> --enable-ftp \
> --enable-inline-optimization \
> --enable-magic-quotes \
> --enable-mbstring \
> --enable-mm=shared \
> --enable-safe-mode \
> --enable-track-vars \
> --enable-trans-sid \
> --enable-wddx=shared \
> --enable-xml \
> --with-dom \
> --with-gd \
> --with-gettext \
> --with-mysql=/usr/local/mysql \
> --with-regex=system \
> --with-xml \
> --with-zlib-dir=/usr/lib[root@localhost httpd-2.2.15]# make;make install (等)
开始配置环境
Php.ini 用php.ini-development php.ini-production 两个文件中的任意一个 php.ini-dist 也可以 但有的包里面没有
[root@localhost php-5.3.2]# cp php.ini-development /usr/local/lib/php.ini
[root@localhost php-5.3.2]# ln -s /usr/local/lib/php.ini /etc/php.ini
[root@localhost php-5.3.2]# ln -s /usr/local/apache/conf/httpd.conf /etc/httpd.conf
[root@localhost htdocs]# ln -s /usr/local/apache/bin/apachectl /etc/rc.d/init.d/apache
[root@localhost rc3.d]# ln -s /etc/rc.d/init.d/apache /etc/rc.d/rc3.d/S90apache
现在可以向下面这样启动apache
/etc/rc.d/init.d/apache start
现在配置apache 使php能够执行
[root@localhost rc3.d]# vi /etc/httpd.conf
如果找不下面的 就添加AddType application/x-tar .tgzAddType application/x-httpd-php .php .foo (主要是这句)AddType application/x-httpd-php-source .phps .phtmlsAddType application/x-httpd-php .php .htm .html
<IfModule mod_dir.c>DirectoryIndex index.php index.htm index.html
</IfModule>
测试环境
[root@localhost rc3.d]# cd /usr/local/apache/htdocs/
[root@localhost htdocs]# vi index.php
写入
<?php
phpinfo();
?>
保存退出
访问 http://服务器的ip/index.php 看看会不会有错误出现 (最好从头看到尾)
错误提示 解决办法在下面的常见问题中
Warning: phpinfo() [function.phpinfo]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Chongqing' for 'CST/8.0/no
常见问题
mysqladmin 不能使用
http://www.cnblogs.com/qingfeng2010/archive/2011/01/03/1924787.html
mysql 安全
http://www.symantec.com/connect/articles/securing-mysql-step-step
mysql 刷新
flush privileges;
Mysql 启动方式
/etc/rc.d/init.d/mysql start | stop | restart
Apache 启动方式
/usr/local/apache/bin/apachectl start | stop | restart
最终启动方式
service apache start | stop | restart
service mysql start | stop | restart
MySQL Security Issues
First, we will assume that only applications on the same server will be allowed to access the database (i.e., not a program running on a physically separate server). So we'll tell MySQL not to even listen on port 3306 for TCP connections like it does by default.
Edit /etc/my.cnf
and uncomment the
skip-networking
line (delete the leading #
).
For more security info, check out this MySQL security tutorial.
Php 出下面错误
Configuring SAPI modules
checking for AOLserver support... no
checking for Apache 1.x module support via DSO through APXS... configure: error: You have enabled Apache 1.3 support while your server is Apache 2. Please use the appropiate switch --with-apxs2
只需 把 ./configure 后面的
Ø --with-apxs=/usr/local/apache/bin/apxs \
换成
Ø --with-apxs2=/usr/local/apache/bin/apxs \
本文中用的是 后者 如果不行 可以 以上两种方式 都式一下
查看 ./configure 的用法
[root@localhost php-5.3.2]# ./configure –help
Php.ini 用php.ini-development php.ini-production 两个文件中的任意一个
php.ini-dist 也可以 但有的包里面没有
输入IP 访问的是 /usr/local/apache/htdocs/ 这个文件夹
你也可以在 httpd.conf 中查找
DocumentRoot 这个后面跟着的路径就是直接输入IP 所访问到的文件夹
访问
http://服务器的ip/index.php
往下看 看看会有错误出现
Warning: phpinfo() [function.phpinfo]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Chongqing' for 'CST/8.0/no
解决办法:
1. 把 index.php 修改成 下面的代码
<?php
date_default_timezone_set ('Asia/Shanghai');
phpinfo();
?>
重启 apache
[root@localhost htdocs]# /etc/rc.d/init.d/apache restart
如果不出现错误 可以去 编辑/etc/php.ini 添加设置时区
添加 下面一句话
date.timezone =Asia/Shanghai
保存 退出
重启 apache
[root@localhost htdocs]# /etc/rc.d/init.d/apache restart
默认打开的程序 设置
编辑 /etc/httpd.conf 修改下面内容DirectoryIndex后面跟的 所有文件名以空格格开 打开时 会按先后顺序打开 如果index.php存在则打开;index.php 不存在 则打开 index.html
<IfModule dir_module>
DirectoryIndex index.php index.html
</IfModule>
保存 退出
记得要重启 apache
service apache restart
要撑握的知识
命令
groupadd
useradd
ln
了解mysql安全
转载于:https://www.cnblogs.com/qingfeng2010/archive/2011/01/07/1930333.html
linux centos apache+php+mysql 安装( 用包安装 非yum 安装)相关推荐
- 如何在Ubuntu 20.04上安装Linux,Apache,MySQL,PHP(LAMP)堆栈[快速入门]
介绍 (Introduction) In this quickstart guide, we'll install a LAMP stack on an Ubuntu 20.04 server. 在本 ...
- Linux+Nginx+Apache+Atlas+Mysql+Php+Redis 分部式部署详细版
环境描述: 192.168.30.131 Nginx-proxy.test.com 192.168.30.132 Apache1.test.com 192.168.30.133 Apache2.tes ...
- LAMP基础环境的搭建,即Linux、Apache、MySQL、PHP环境
LAMP基础环境的搭建,即Linux.Apache.MySQL.PHP环境 测试环境: 主机:windows server 2008 R2 64位 虚拟机:VMware Workstation 11. ...
- ZH奶酪:Ubuntu 14.04配置LAMP(Linux、Apache、MySQL、PHP)
ZH奶酪:Ubuntu 14.04安装LAMP(Linux,Apache,MySQL,PHP) 之前已经介绍过LAMP的安装,这边文章主要讲解一下LAMP的配置. 1.配置Apache (1)调整Ke ...
- PHP实习之路—NO.1(看LINUX、APACHE、MYSQL、PHP文档)
PHP实习之路-NO.1(看LINUX.APACHE.MYSQL.PHP文档): 基本功一定要扎实! 本文转自 Lee_吉 博客,原文链接: http://blog.51cto.com/121 ...
- linux的mysql本地yum安装_Linux系统下使用yum安装mysql
1.安装rpm包 直接使用yum -y install 命令安装mysql是无法安装mysql的高级版本,需要先安装带有可用的mysql5系列社区版资源的rpm包,输入如下命令进行安装. 2.查看my ...
- linux安装mysql允许外部访问权限_Linux yum 安装mysql以及进行授权允许远程登录
一.安装查看有没有安装过 yum list installed mysql* rpm -qa | grep mysql* 查看有没有安装包: yum list mysql* 安装mysql客户端: y ...
- mysql重置root密码centos_详解如何在Linux(CentOS)下重置MySQL根(Root)密码
本例中以CentOS6.6下修改MySQL5.1.73举例说明. 1.首先输入"service mysqld status"查看当前mysql服务状态,下图显示正在mysqld服务 ...
- linux7.0安装中文包,Centos7使用yum命令安装中文语言包
查看系统版本[root@localhost ~]# cat /etc/redhat-release CentOS Linux release 7.0.1406 (Core) 安装语言包[root@lo ...
最新文章
- 在CentOS 6.6 64bit上编译安装LLVM3.7,Clang,Libc++和libc++abi
- Python实现阿里云aliyun服务器里的文件上传与下载
- 重磅!Nature子刊发布稳定学习观点论文:建立因果推理和机器学习的共识基础...
- http基于用户的访问控制--实战
- android启动---lk入口文件crt0.s解析
- 高并发下秒杀商品,必须知道的9个细节
- 再见安卓 你好鸿蒙,安卓,再见!你好,鸿蒙系统!
- raspberry pi_如何使用Raspberry Pi构建WiFi相框
- ios授权登录过程中一直提示“没有安装qq”
- 何凯明 Single Image Haze Removal Using Dark Channel Prior
- 国外大神制作的史上最精简Win10系统,真有那么好用吗?
- 带时间窗的车辆路径规划问题(VRPTW)
- couldn't connect to the device trackpad
- 教你轻松获取windows10锁屏壁纸
- 为什么配置智能DNS解析的时候一定要有默认线路?
- 画布渐变以及svg图形
- VMware虚拟机无法连接外网怎么解决
- 详解HTTPS通信流程,使用JDK,openssl,XCA进行证书认证详细操作,Spring Boot配置SSL证书实操
- Java核心技术之Comparator和Comparable在排序中的应用
- 国内首家,阿里云发布Redis全球多活版