Obtain the supporting files needed to install php: libxml2 or directly download libxml2-2.9.1.tar.gz
If the installation is successful, five directories, bin, include, lib, man and share will be generated under the /usr/local/libxml2/ directory. When installing the configuration of the PHP5 source code package later, the option "--with-libxml-dir=/usr/ local/libxml2" will be added to the options of the configure command to specify the location of the libxml2 library file.
# tar zvxf php-5.3.8.tar.gz #cd php-5.3.8
#. /configure \
- - prefix=/usr/local/php \
- - with-mysql=/usr/local/mysql \
- - with-apxs=/usr/local/apache2/bin/apxs \
- - with-libxml-dir=/usr/local/libxml2
# make
# make install
# vi /usr/local/apache/conf/httpd.conf
Find AddType application/x-gzip .gz .tgz and add the following content under it
AddType application/x-httpd-php .php (with a space in front of it)
AddType application/x-httpd-php-source .phps (. There is a space in front of it)
cp php-5.3.8/php.ini.dist /usr/local/php/lib/php.ini
(If there is no php.ini.dist, just rename any one of php.ini-development php.ini-production to php.ini.dist.)
Modify the php.ini file register_globals = On
service apache restart
Write a php test page info.php and put it in apache2/htdocs.
php phpinfo(); ?>;Enter in the browser: server address/info.php
If the php information can be displayed normally, it means that Apche+Mysql+PHP is installed successfully!
CentOS 5.5 uses yum to install LAMP
1. Change source, use sohu installation source
1.1 Backup CentOS-Base.repo
cd /etc/yum.repos.d/
cp CentOS-Base.repo CentOS-Base.repo.bak
1.2 Replacement source
Open CentOS-Base.repo with vi and empty the content, then copy the content below and save it.
[ base]
name=CentOS-
gpgcheck=1
gpgkey=http://mirrors.sohu.com/centos/RPM-GPG-KEY-CentOS-5
[ updates]
name=CentOS-
gpgcheck=1
gpgkey=http://mirrors.sohu.com/centos/RPM-GPG-KEY-CentOS-5
[ addons]
name=CentOS-
gpgcheck=1
gpgkey=http://mirrors.sohu.com/centos/RPM-GPG-KEY-CentOS-5
[ extras]
name=CentOS-
gpgcheck=1
gpgkey=http://mirrors.sohu.com/centos/RPM-GPG-KEY-CentOS-5
[ centosplus]
name=CentOS-
gpgcheck=1
enabled=0
gpgkey=http://mirrors.sohu.com/centos/RPM-GPG-KEY-CentOS-5
1.3 Update yum -y update
2. Install Apache, Mysql, PHP with yum
2.1 Install Apache
yum install httpd httpd-devel
After the installation is complete, start apache
/etc/init.d/httpd start
Set to boot up: chkconfig httpd on
2.2 Install mysql
yum install mysql mysql-server mysql-devel
After completion, start mysql
/etc/init.d/mysqld start
2.2.2 Set mysql password
mysql -uroot
mysql> USE mysql;
mysql> UPDATE user SET Password=PASSWORD('newpassword') WHERE user='root'; FLUSH PRIVILEGES;
2.2.3 Allow remote login
mysql -u root -p
Enter Password:
mysql>GRANT ALL PRIVILEGES ON . TO 'username'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION; FLUSH PRIVILEGES;
After completion, you can use mysql-front to remotely manage mysql.
2.2.4 Set to boot
chkconfig mysqld on
3. Install php
yum install php php-mysql php-common php-gd php-mbstring php-mcrypt php-devel php-xml
/etc/init.d/httpd start
4. have a test
4.1 Create a new test.php file in /var/www/html/, write the following content, and then save.
4.2 Firewall configuration
a. Add. Allow access to port {21: ftp, 80: http}.
iptables -I RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 21 -j ACCEPT
iptables -I RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT
b. Turn off the firewall {not recommended}.
service iptables stop
c. Reset loading firewall
service iptables restart
4.3 Then open http://serverip/test.php in the client browser, if it can be displayed successfully, it means the installation is successful.
At this point, the installation is complete. With emotion, yum is so easy to use.
PHP upgrade
First check the current php version
#php -v
Upgrade php version
rpm --import http://repo.webtatic.com/yum/RPM-GPG-KEY-webtatic-andy
wget -P /etc/yum.repos.d/ http://repo.webtatic.com/yum/webtatic.repo
yum --enablerepo=webtatic update php mysql
It is best to upgrade php with mysql, and you can see that php has been upgraded to 5.3.28
3、 View the upgraded php version
# php -v
PHP 5.3.28 (cli) (built: Dec 15 2013 17:43:05)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2013 Zend Technologies
You can see that the version of php has been updated to 5.3.X
Restart /etc/init.d/httpd restart or apache service httpd restart
Upgrade 2 (recommended)
1 ) Pre-installed
yum --enablerepo=remi,remi-php55 install php-pecl-apc php-cli php-pear php-pdo php-mysqlnd php-pgsql php-pecl-mongo php-sqlite php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml
2 ) Upgrade php
yum --enablerepo=remi,remi-php55 install php-opcache
Unable to load dynamic library '/usr/lib64/php/modules/gd.so
[ root@ithomer ~]# php -v
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/gd.so' - libvpx.so.0: cannot map zero-fill pages: Cannot allocate memory in Unknown on line 0
PHP 5.5.9 (cli) (built: Feb 18 2014 14:51:49)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies
solve:
Error: Package: php-common-5.3.28-2.w5.x86_64 (webtatic)
Requires: libcurl.so.3()(64bit)
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
yum install libcurl libcurl-devel
MySQL upgrade
The source mysql of CentOS 5.5 is currently still on 5.0.19. When you want to be the master-slave of the database, you must upgrade to 5.1 or higher, simply directly to 5.5.36
1、 Install the yum source of MySQL 5.5.x:
rpm -Uvh http://repo.webtatic.com/yum/centos/5/latest.rpm
2、 Install the support package for the MySQL client:
yum install libmysqlclient15 --enablerepo=webtatic
3、 Uninstall the packages of the old version of MySQL:
yum remove mysql mysql-*
4、 Install the client and server of MySQL 5.5:
yum install mysql55 mysql55-server --enablerepo=webtatic
5、 Start the MySQL system service and update the database:
/etc/init.d/mysqld restart
mysql_upgrade -uroot -proot
Upgrade complete
/etc/init.d/mysqld restart
Upgrade 1 (recommended)
To list Old MySql
yum list installed | grep -i mysql
To remove Old MySql
yum remove mysql mysql-*
Remi Dependency on CentOS 6 and Red Hat (RHEL) 6
rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
Install MySQL server
yum --enablerepo=remi,remi-test install mysql mysql-server
To list New MySql
yum list installed | grep -i mysql
start MySql server
/etc/init.d/mysqld start ## use restart after update
OR
service mysqld start ## use restart after update
chkconfig --levels 235 mysqld on
Last
mysql_upgrade -u root -p
Now my MySql version is 5.5.32
Ref:
http://www.webtatic.com/packages/mysql55/
http://www.if-not-true-then-false.com/2010/install-mysql-on-fedora-centos-red-hat-rhel/
update MySQL version from 5.1 to 5.5 in CentOS 6.2
1、 Create MariaDB.repo under /etc/yum.repos.d/
$ cd /etc/yum.repos.d
$ vim /etc/yum.repos.d/MariaDB.repo
Add the following configuration:
[ mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.0/centos6-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
If it is another operating system, you can find relevant information in here.
**2、 Install MariaDB using YUM **
$ sudo yum -y install MariaDB-client MariaDB-server MariaDB-devel
**3、 Start the database **
$ sudo service mysql start
4、 Modify Root password
$ mysqladmin -u root password ‘passwd’
5、 Configure remote access, MariaDB binds ip (127.0.0.1) by default for security.
$ mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 4
Server version: 10.0.4-MariaDB MariaDB Server
Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>GRANT ALL PRIVILEGES ON . TO 'root'@'%' IDENTIFIED BY ‘passwd’ WITH GRANT OPTION;
MariaDB [(none)]> flush privileges;
The "%" in the first sentence means that any host can remotely log in to the server for access. If you want to restrict access to only a certain machine, just change it to the corresponding IP, such as:
GRANT ALL PRIVILEGES ON . TO root@"172.168.193.25" IDENTIFIED BY "root";
The second sentence means to reload the permission data from the grant table of the mysql database. Because MySQL stores all permissions in the cache, it needs to be reloaded after making changes.
6、 Firewall configuration
If the system firewall is on (or behind a hardware firewall or NAT), you must open the TCP port used by mysql, which is usually 3306.
7、 Case Sensitive
After logging in with the root account, add lower_case_table_names=1 after [mysqld] in /etc/my.cnf and restart the MYSQL service. At this time, it has been set successfully: the case of the table name is not distinguished;
Detailed explanation of lower_case_table_names parameters:
lower_case_table_names = 0
Among them, 0: case-sensitive, 1: case-insensitive
ERROR 1045 (28000): Access denied for user 'ithomer'@'localhost' (using password: YES)
/etc/init.d/mysqld stop
mysqld_safe --skip-grant-tables &
mysql -u root
mysql> use mysql;
mysql> grant all privileges on . to "root"@"%" identified by "password" with grant option; flush privileges; # Add user
mysql> grant Select on your_dbname.* to "username"@"%" identified by "password" with grant option; flush privileges; # Assign read-only permissions (Select)
mysql> update user set password=PASSWORD("newrootpassword") where User='root'; flush privileges; # Modify password
mysql> quit
/etc/init.d/mysqld restart
/etc/init.d/mysqld stop
/etc/init.d/mysqld start
rpm installation
rzsz installation
ubuntu: sudo apt-get install lrzsz
centos: yum -y install lrzsz
hostname modification
Two things need to be modified:
1 ) Vim /etc/sysconfig/network modify HOSTNAME=your_hostname
2 ) Vim /etc/hosts modify 12.160.134.168 your_hostname
Python installation
1 ) Download Python, directly download Python-2.7.6.tar.xz
2 ) Install .tar.xz decompression tool: yum -y install xz
3 ) Unzip the .tar.xz file: unxz Python-2.7.6.tar.xz and tar xvf Python-2.7.6.tar
4 ) cd Python-2.7.6
5 ) ./configure --prefix=/usr/local --enable-unicode=ucs4 --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
make && make altinstall
pip install
1 ) wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
2 ) python2.7 ez_setup.py
3 ) easy_install-2.7 pip
4 ) pip2.7 install [packagename]
pip2.7 install --upgrade [packagename]
pip2.7 uninstall [packagename]
LAMP configuration screenshot
Upgrade 3-httpd (apache server)
$ vi /etc/yum.repos.d/centalt.repo
[ CentALT]
name=CentALT Packages for Enterprise Linux 6 -
enabled=1
gpgcheck=0
yum update httpd
Reference: Upgrade apache/httpd to 2.2.23 in CentOS
Install Git
The old version (1.7.1) is installed through the command yum install git
To install the latest git, the steps are as follows:
1 ) yum install perl-DBI -y
2 ) wget http://pkgs.repoforge.org/git/git-1.7.10-1.el6.rfx.x86_64.rpm
wget http://pkgs.repoforge.org/git/perl-Git-1.7.10-1.el6.rfx.x86_64.rpm
3 ) rpm -i git-1.7.10-1.el6.rfx.x86_64.rpm perl-Git-1.7.10-1.el6.rfx.x86_64.rpm
4 ) git --version
git version 1.7.10
Reference: Reference 1, Reference 2, github requires git version 1.7.6 or higher
Install Subversion
1 ) Install the client, command: yum install subversion
Install SVN server in Centos 6.x
Reference recommendation:
Linux installation configuration php
Ubuntu installation and configuration MySQL
CentOS 5.5 uses yum to install LAMP
Install Apache+PHP+MySQL under Win7
MySQL assign user permissions GRANT usage (recommended)
WordPress installation process
WordPress database and table structure
2 ) wget http://pkgs.repoforge.org/git/git-1.7.10-1.el6.rfx.x86_64.rpm
Recommended Posts