Installing Apache+php+mysql

Source: Internet
Author: User
Tags install php mcrypt

@flyok666 2018-07-01 16:58 字数 4762 阅读 333Installing Apache+php+mysql

未分类

Version information:
apache2.4
php7.2
mysql5.6

Put the required software under the/root/software/folder

Install Apache and the required dependent installation zlib
cd /root/softwaretar xf zlib-1.2.8.tar.gzcd zlib-1.2.8./configuremakemake installcd ..
Install Apr
tar xf apr-1.5.2.tar.gzcd apr-1.5.2./configure --prefix=/usr/local/aprmakemake installcd ..
Installing Apr-iconv
tar xf apr-iconv-1.2.1.tar.gzcd apr-iconv-1.2.1./configure --prefix=/usr/local/apr-iconv --with-apr=/usr/local/apr/makemake installcd ..
Installing Apr-util
tar xf apr-util-1.5.4.tar.gzcd apr-util-1.5.4./configure --prefix=/usr/local/apr-util/ --with-apr=/usr/local/apr/ --with-apr-iconv=/usr/local/apr-iconv/bin/apr-iconvmakemake installcd ..
Installing Pcre
tar xf pcre-8.39.tar.gzcd pcre-8.39./configure --prefix=/usr/local/pcremakemake installcd ..
Error * * * * ERROR Configure:error:You need a C + + compiler for C + + support solution:
Yum install-y gcc gcc-c++
Installing Pcre-devel
yum -y install pcre-devel
Installing httpd
tar xf httpd-2.4.17.tar.gzcd httpd-2.4.17./configure --prefix=/usr/local/lamp/apache2 --enable-modules=all --enable-so --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre/makemake installcd ..
Configuring the HTTPD Management Manager script
chmod u+x httpdcp httpd /etc/init.d/httpd
Set servername
echo "ServerName 127.0.0.1:80" >> /usr/local/lamp/apache2/conf/httpd.conf
Open service
service httpd start
Add to boot Service
chkconfig --add httpdchkconfig --level 345 httpd on
Install PHP and the required dependent installation LIBXML2
ln -sf /usr/local/lib/libz.so.1.2.8 /usr/lib64/libz.sotar xf libxml2-2.7.2.tar.gzcd libxml2-2.7.2./configuremakemake installcd ..
Install JPEG
tar xf jpegsrc.v9b.gzcd jpeg-9b/./configure --prefix=/usr/local/jpeg --enable-shared --enable-staticmakemake installcd ..
Install PNG
tar xf libpng-1.4.3.tar.gzcd libpng-1.4.3./configure --prefix=/usr/local/png --enable-shared --enable-staticmakemake installcd ..
Installing FreeType
tar xf freetype-2.7.tar.gzcd freetype-2.7./configure --prefix=/usr/local/freetype --enable-sharedmakemake installcd ..
Installing GD
tar xf libgd-2.2.3.tar.gzcd libgd-2.2.3./configure --prefix=/usr/local/gd --with-jpeg=/usr/local/jpeg/ --with-png=/usr/local/png --with-zlib --with-freetype=/usr/local/freetype --disable-werrormakemake installcd ..
Installing Bison
yum -y install bison
Installing Libmcrypt
tar xf libmcrypt-2.5.8.tar.gzcd libmcrypt-2.5.8./configure --disable-posix-threadsmakemake installcd ..

Save the Libmcrypt path to the environment variable so that you can search for the required package MCrypt the installation

export LD_LIBRARY_PATH=/usr/local/lib
Installing Mhash
tar xf mhash-0.9.9.9.tar.gzcd mhash-0.9.9.9./configuremakemake installcd ..
Installing MCrypt
tar xf mcrypt-2.6.8.tar.gzcd mcrypt-2.6.8./configure --with-libmcrypt-prefix=/usr/localmakemake installcd ..
Installing autoconf
tar xf autoconf-2.69.tar.gzcd autoconf-2.69./configuremakemake installcd ..
Installing Libiconv
tar xf libiconv-1.14.tar.gzcd libiconv-1.14./configure --prefix=/usr/local/libiconvmakemake installcd ..
Installing LIBXPM
yum -y install libXpm-devel
Install PHP
tar xf php-7.1.8.tar.bz2cd php-7.1.8./configure --prefix=/usr/local/lamp/php --with-apxs2=/usr/local/lamp/apache2/bin/apxs --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-freetype-dir=/usr/local/freetype --with-gd=/usr/local/gd/ --with-zlib --with-jpeg-dir=/usr/local/jpeg --with-png-dir=/usr/local/png --enable-mbstring=all --enable-mbregex --enable-shared --disable-fileinfo --with-iconv=/usr/local/libiconv --with-libxml-dir=/usr/local --with-xpm-dir=/usr/lib --enable-fpm makemake installcp php.ini-development /usr/local/lamp/php/lib/php.inicd ..
Configure the time zone
echo "date.timezone = PRC" >> /usr/local/lamp/php/lib/php.ini
Let Apache support PHP
echo "AddHandler application/x-httpd-php .php" >> /usr/local/lamp/apache2/conf/httpd.conf
Restart Apache
service httpd restart
Install MySQL and the required dependent installation Ncurses-devel
yum -y install ncurses-devel
Installing CMake

Because the new version of MySQL does not have. Configure is packaged by CMake

yum -y install cmake
Install MySQL
tar xvf mysql-5.6.25.tar.gzcd mysql-5.6.25cmake -DCMAKE_INSTALL_PREFIX=/usr/local/lamp/mysql -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS:STRING=utf8,gbk -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_DATADIR=/usr/local/lamp/mysql/data -DMYSQL_USER=mysqlmakemake install

Don't worry, oh .... This should be the longest waiting ...

Add user

Users do not need to log on to the system, so the designated user login after the shell is Nologin, prohibit login,-R indicates system account, System account UID is small

useradd -s /sbin/nologin -r mysql

Modify directory permissions to change the data folder owner to MySQL
The data folder is used to store the information, it must be guaranteed that the MySQL user can write operations, because the entire installation process is root user execution, so the other folders are input root user

chown mysql.mysql /usr/local/lamp/mysql/data -R
Copying a configuration file
cp support-files/my-default.cnf /etc/my.cnf
Creating a MySQL test database and system database
 cd /usr/local/lamp/mysql scripts/mysql_install_db --user=mysql --datadir=/usr/local/lamp/mysql/data
Test start MySQL
/usr/local/lamp/mysql/bin/mysqld_safe &
Log in to MySQL
/usr/local/lamp/mysql/bin/mysql -urootmysql> show databases;
Change password, increase security
mysql> SET PASSWORD FOR ‘root‘@‘localhost‘ = PASSWORD(‘newpass‘);
Create a user that allows remote logins
mysql> CREATE USER ‘itsource‘@‘%‘ IDENTIFIED BY ‘123456‘;mysql> select password(‘123456‘);mysql> GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY PASSWORD ‘xxxxxx‘;
Add MySQL to system service

Copying startup files

Add executable permissions

You can use the service mysqld to control the MySQL server by doing the above steps.
For example: Service mysqld start can launch MySQL server

Add to boot Service
chkconfig --add mysqldchkconfig --level 345 mysqld on
+

Installing Apache+php+mysql

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.