CentOS7 + Apache2.4 + Mysql5.5 + PHP5.5
时间:2015-05-22 00:56 来源:51cto.com 作者:IT
yum install -y gcc gcc-c++
安装MySql
# rpm -ivh MySQL-devel-5.6.24-1.linux_glibc2.5.x86_64.rpm
# rpm -ivh MySQL-server-5.6.24-1.linux_glibc2.5.x86_64.rpm
# rpm -ivh MySQL-client-5.6.24-1.linux_glibc2.5.x86_64.rpm
#mysql --version
mysql Ver 14.14 Distrib 5.6.24, for Linux (x86_64) using EditLine wrapper
#yum list *maria*
mariadb.x86_64 1:5.5.41-2.el7_0 @base
mariadb-libs.x86_64 1:5.5.41-2.el7_0 @base
mariadb-server.x86_64 1:5.5.41-2.el7_0 @base
#mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
#systemctl start mariadb.service
#systemctl enable mariadb.service #因为mariadb服务启动正常,将mariadb设置为开机自动启动.
# sudo mysql_secure_installation
/usr/mysql_secure_installation: line 379: find_mysql_client: command not found
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
You already have a root password set, so you can safely answer 'n'.
Change the root password? [Y/n] n
... skipping.
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] y
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] Y
... Success!
By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] Y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] Y
ERROR 1146 (42S02) at line 1: Table 'mysql.servers' doesn't exist
... Failed!
Cleaning up...
All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 24
Server version: 5.5.41-MariaDB MariaDB Server
Copyright (c) 2000, 2014, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
安装我们的战斗机(Apache)
#gzip -d httpd-2.4.12.tar.gz
#tar xvf httpd-2.4.12.tar
#cd httpd-2.4.12
# ./configure --prefix=/usr/local/apache
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
configure:
configure: Configuring Apache Portable Runtime library...
configure:
checking for APR... no
configure: error: APR not found. Please read the documentation.
#mkdir /usr/local/apr
#tar -zxvf apr-1.5.2.tar.gz
#cd apr-1.5.2
#./configure --prefix=/usr/local/apr
balabala......
#make
#make install
#tar -zxvf apr-util.1.5.4.tar.gz
#cd apr-util
#./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config
#make
#make install
# mkdir /usr/local/pcre
# tar -zxvf pcre-8.37.tar.gz
# ./configure --prefix=/usr/local/pcre --with-apr=/usr/local/apr/bin/apr-1-config
# make
# make install
# cd httpd-2.4.12
# ./configure --prefix=/usr/local/apache --with-pcre=/usr/local/pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util
# make
# make install
安装PHP
# tar -zxvf php-5.5.25.tar.gz
# cd php-5.5.25
# mkdir /usr/local/php
# ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-config-file-path=/usr/local/lib --enable-track-var --with-xml --with-mysql --with-zlib-dir=/usr/local
configure: error: xml2-config not found. Please check your libxml2 installation.
# tar -zxvf libxml2-2.9.2.tar.gz
# cd libxml2-2.9.2
# mkdir /usr/local/libxml2
# ./configure --prefix=/usr/local/libxml2
#make
libxml.c:14:20: fatal error: Python.h: No such file or directory
#include <Python.h>
# yum search python|grep python-devel
dbus-python-devel.i686 : Libraries and headers for dbus-python
dbus-python-devel.x86_64 : Libraries and headers for dbus-python
gstreamer-python-devel.i686 : Headers for developing programs that will use
gstreamer-python-devel.x86_64 : Headers for developing programs that will use
python-devel.x86_64 : The libraries and header files needed for Python
# yum install python-devel.x86_64
# ./configure --prefix=/usr/local/libxml2
#make
#make install
# ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-config-file-path=/usr/local/lib --enable-track-var --with-xml --with-mysql --with-zlib-dir=/usr/local
Configuring SAPI modules
Running system checks
General settings
Configuring extensions
configure: error: xml2-config not found. Please check your libxml2 installation.
#yum list *libxml*
#yum install libxml2-devel.x86_64
#./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-libxml2=/usr/local/libxml2 --with-mysql=/usr/bin/mysql
Configuring SAPI modules
Running system checks
General settings
Configuring extensions
configure: error: Cannot find MySQL header files under /usr/bin/mysql.
Note that the MySQL client library is not bundled anymore!
# yum list *mariadb*
# yum install mariadb-devel.x86_64
# ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-libxml2=/usr/local/libxml2 --with-config-file-path=/usr
vim /var/www/info.php
<?php
phpinfo();
?>
(责任编辑:IT)
安装MySql
安装我们的战斗机(Apache)
安装PHP
|

