Centos-7.4lamp architecture Discuz Forum

Keywords: MySQL PHP Database Apache

Linux-centos-7 lamp Architecture Forum page details

Experiment purpose: to set up a forum web page on LAMP framework

I. overview of LAMP architecture

Three components are needed: Linux, Apache and mysql. Their source packages are private to me and I will send them to you. You don't need to go to the official documents again.

1. Understand the origin of Apache

2. Advantages of compiling and installing httpd server

3. httpd.conf configuration file parameters

Listen: listening IP address, port number
ServerName: domain name of the web server
These two we need to modify later

IV. httpd.conf configuration file parameters (Continued)

5. We first share the source code package we need on the host

(if your shared file linux can't access the shared file, check your local policy, refuse to access this computer from the network, delete your users, check your network, no, please see my previous blog)


Vi. setting IP address of vmnet1 network card of host computer

7. liunx Centos7 to visit and mount the shared file.

[root@localhost ~]# smbclient -L //192.168.100.3 / / / access the IP address of the host
Enter SAMBA\root's password: 
OS=[Windows 10 Enterprise 17763] Server=[Windows 10 Enterprise 6.3]

    Sharename       Type      Comment
    ---------       ----      -------
    ADMIN$          Disk      Remote management
    C$              Disk      Default sharing
    D$              Disk      Default sharing
    E$              Disk      Default sharing
    F$              Disk      Default sharing
    G$              Disk      Default sharing
    IPC$            IPC       Long-range IPC
    LAMP            Disk      
    LAMP-C7         Disk      
    share           Disk      
    Users           Disk      
Connection to 192.168.100.3 failed (Error NT_STATUS_RESOURCE_NAME_NOT_FOUND)
NetBIOS over TCP disabled -- no workgroup available
[root@localhost ~]# mount.cifs //192.168.100.3/LAMP-C7 /mnt / / mount to the mnt directory
Password for root@//192.168.100.3/LAMP-C7:  
[root@localhost ~]# cd /mnt
[root@localhost mnt]# ls to see if there are these source packages in the mount directory
[root@localhost mnt]# cd /mnt
[root@localhost mnt]# ls
apr-1.6.2.tar.gz       Discuz_X2.5_SC_UTF8.zip  LAMP-php5.6.txt      php-5.6.11.tar.bz2
apr-util-1.6.0.tar.gz  httpd-2.4.29.tar.bz2     mysql-5.6.26.tar.gz

8. Decompress the underlying cross platform toolkit to the opt directory

tar zxvf apr-1.6.2.tar.gz -C /opt
tar zxvf apr-util-1.6.0.tar.gz -C /opt

9. Extract the HTTP toolkit to the opt directory, and then put the two files extracted from the cross platform toolkit under the HTTP toolkit.

tar jxvf httpd-2.4.29.tar.bz2 -C /opt
mv apr-1.6.2 httpd-2.4.29/srclib/apr
mv apr-util-1.6.0 httpd-2.4.29/srclib/apr-util
[root@localhost mnt]# cd /opt
[root@localhost opt]# ls
apr-1.6.2  apr-util-1.6.0  httpd-2.4.29  rh
[root@localhost opt]# mv apr-1.6.2 httpd-2.4.29/srclib/apr
[root@localhost opt]# mv apr-util-1.6.0 httpd-2.4.29/srclib/apr-util
[root@localhost opt]# ls
httpd-2.4.29  rh

10. Installation environment package

[root@localhost opt]# yum -y install \
gcc \
gcc-c++ \   //Environment language
make \      //Compiled into a language that can be recognized by computers
pcre-devel \  //pcre language, just like regular expression
expat-devel \  //Support for identifying tagging languages
perl    //perl compiler

11. Manual compilation and installation

[root@localhost opt]# cd httpd-2.4.29/
[root@localhost httpd-2.4.29]# ./configure \
> --prefix=/usr/local/httpd \    //"\" for line feed, specify path
> --enable-so \      //apache core module on
> --enable-rewrite \    //Enable rewrite function, anti-theft chain
> --enable-charset-lite \  //Character set support, simplified Chinese
> --enable-cgi   //General Gateway Interface
> 
config.status: creating build/rules.mk
config.status: creating build/pkg/pkginfo
config.status: creating build/config_vars.sh
config.status: creating include/ap_config_auto.h
config.status: executing default commands
configure: summary of build options:
Server Version: 2.4.29
Install prefix: /usr/local/httpd
C compiler:     gcc -std=gnu99
CFLAGS:          -g -O2 -pthread  
CPPFLAGS:        -DLINUX -D_REENTRANT -D_GNU_SOURCE  
LDFLAGS:           
LIBS:             
C preprocessor: gcc -E

12. Convert our configuration file to machine recognizable language, and then install

[root@localhost httpd-2.4.29]# make 

les -module -avoid-version  mod_rewrite.lo 
make[4]: Leave directory“/opt/httpd-2.4.29/modules/mappers"
make[3]: Leave directory“/opt/httpd-2.4.29/modules/mappers"
make[2]: Leave directory“/opt/httpd-2.4.29/modules"
make[2]: Enter directory“/opt/httpd-2.4.29/support"
make[2]: Leave directory“/opt/httpd-2.4.29/support"

make[1]: Leave directory“/opt/httpd-2.4.29"
[root@localhost httpd-2.4.29]# make install
Installing man pages and online manual
mkdir /usr/local/httpd/man
mkdir /usr/local/httpd/man/man1
mkdir /usr/local/httpd/man/man8
mkdir /usr/local/httpd/manual
make[1]: Leave directory“/opt/httpd-2.4.29"

13. Put the apache startup script in

[root@localhost httpd-2.4.29]# cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd / / put the startup script in it for easy management and rename httpd.

14. Go to vi /etc/init.d/httpd to configure the file parameters

Add parameters to the first line of configuration file
#/bin/sh
 #Hkconfig: 35 85 21 / / level 35 automatic operation 85th startup 21th shutdown
#escription: Apache is a World Wide Web server

15. Add httpd to SERVICE manager

[root@localhost init.d]# chkconfig --add httpd
[root@localhost init.d]# 

16.vi /usr/local/httpd/conf/httpd.conf / / configure parameters in the configuration file

#ServerName www.yun.com:80

#Listen 192.168.136.132:80
Listen 80

17. Make soft link

ln -s /usr/local/httpd/conf/httpd.conf /etc/   //Make a soft link and type vim /etc/httpd.conf next time.
ln -s /usr/local/httpd/bin/* /usr/local/bin/   //Make a soft link for your system to recognize

18. Check configuration file syntax error

[root@localhost init.d]# httpd -t
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
Syntax OK
[root@localhost init.d]# apachectl -t
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
Syntax OK

19. Start service

[root@localhost init.d]# systemctl stop firewalld.service / / turn off the firewall
[root@localhost init.d]# setenforce 0 / / disable enhancements
[root@localhost init.d]# service httpd start / / start http service
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
httpd (pid 70331) already running
[root@localhost init.d]# netstat -anpt | grep 80 / / view the listening port
tcp        0      0 192.168.136.132:22      192.168.136.1:58031     ESTABLISHED 3506/sshd: root@pts 
tcp6       0      0 :::80                   :::*                    LISTEN      70331/httpd         
[root@localhost init.d]# 

20. Test whether you can access HTTP service

2. Code and install MYSQL database

[root @ localhost init. D] ා Yum install ncurses devel Autoconf Cmake - Y / / install the environment package and Cmake toolkit.
Loaded plug-ins: faststmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.nju.edu.cn
 * updates: mirrors.nju.edu.cn
 Resolving dependencies
 -->Checking transactions
 --->Software package autoconf.noarch.0.2.69-11.el7

3. Decompress the database software package to opt and compile the environment package

[root@localhost mnt]# cd /mnt

tar xzvf mysql-5.6.26.tar.gz -C /opt
[root@localhost mnt]# cd /opt
[root@localhost opt]# ls
httpd-2.4.29  mysql-5.6.26  rh
[root@localhost opt]# cd /opt/mysql-5.6.26/
[root@localhost mysql-5.6.26]# 
cmake  \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \  //Specify installation path
-DDEFAULT_CHARSET=utf8 \  //Specify character set
-DDEFAULT_COLLATION=utf8_general_ci \  //Specify character set defaults
-DEXTRA_CHARSETS=all \  //Specify extended character set
-DSYSCONFIDIR=/etc \  //Specify profile directory
-DMYSQL_DATADIR=/home/mysql/ \  //Specify the data file in the database
-DMYSQL_UNIX_ADDR=/home/mysql/mysql.sock  //Define a sock file to connect to a database file

4. Compile and install to make the computer recognize

If there is an error, you must check your path, right?
[root@localhost mysql-5.6.26]# make
[root@localhost mysql-5.6.26]# make install
[100%] Building CXX object libmysqld/examples/CMakeFiles/mysql_embedded.dir/__/__/client/readline.cc.o
Linking CXX executable mysql_embedded
[100%] Built target mysql_embedded
Scanning dependencies of target mysqltest_embedded
[100%] Building CXX object libmysqld/examples/CMakeFiles/mysqltest_embedded.dir/__/__/client/mysqltest.cc.o
Linking CXX executable mysqltest_embedded
[100%] Built target mysqltest_embedded
Scanning dependencies of target my_safe_process
[100%] Building CXX object mysql-test/lib/My/SafeProcess/CMakeFiles/my_safe_process.dir/safe_process.cc.o
Linking CXX executable my_safe_process
[100%] Built target my_safe_process

V. configuration database

[root@localhost mysql-5.6.26]# CP support files / my-default.cnf / etc / my.cnf / / put the configuration file in
cp: Is it covered?"/etc/my.cnf"? yes
[root@localhost mysql-5.6.26]# 
[root@localhost mysql-5.6.26]# CP support files / MySQL. Server / etc / init. D / mysqld / / put the configuration file in the startup script
cp: Is it covered?"/etc/init.d/mysqld"? yes
[root@localhost mysql-5.6.26]# chmod 755 /etc/init.d/mysqld / / add execution permission
[root@localhost mysql-5.6.26]# chkconfig --add /etc/init.d/mysqld / / add the service to the service manager
[root@localhost mysql-5.6.26]# Chkconfig mysqld -- level 35 on / / level 35 on
[root@localhostmysql5.6.26]#echo "PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile
//Start system environment variable
[root@localhost mysql-5.6.26]# source /etc/profile / / start the system environment variable
[root@localhost mysql-5.6.26]# echo $PATH / / check whether the system environment variable has been added.
/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/root/bin:/usr/local/mysql/bin:/usr/local/mysql/bin:/usr/local/mysql/bin
[root@localhost mysql-5.6.26]# useradd -s /sbin/nologin mysql / / creates a program user and prevents it from logging into the local console
[root@localhost mysql-5.6.26]# chown -R mysql:mysql / / upgrade the permissions of all users under the path / usr/local/mysql/

Vi. initialize database

[root@localhost mysql-5.6.26]# /Usr / local / MySQL / scripts / MySQL? Install? DB \ / / initialize the database
--user=mysql \   //Database users
--ldata=/var/lib/mysql \   //data
--basedir=/usr/local/mysql \  //Database directory
--datadir=/home/mysql  //Database storage directory

7. Open the database and view the port

[root@localhost mysql]# vim /etc/init.d/mysqld 

46 basedir=/usr/local/mysql   //Indicate path 46 lines
 47 datadir=/home/mysql    //Indicate database storage location 47 lines

[root@localhost mysql]# vim /etc/init.d/mysqld 
[root@localhost mysql]# service mysqld start / / start the database
Starting MySQL.... SUCCESS! 
[root@localhost mysql]# netstat -anpt | grep 3306 / / view the listening port
tcp6       0      0 :::3306                 :::*                    LISTEN      6458/mysqld         

8. Set password for database administrator

[root@localhost mysql]# mysqladmin -u root -p password "abc123"
Enter password:
Warning: Using a password on the command line interface can be insecure.

IX. install PHP environment

root@localhost opt]# yum -y install \
gd \     //Image processing,
libpng \    //Support for PNG pictures
libpng-devel \
pcre \
pcre-devel \
libxml2-devel \   //Support parsing, tagging language
libjpeg-devel      //Support for jpg picture format

X. decompress and associate database and APACHE

[root@localhost mnt]# tar xjvf php-5.6.11.tar.bz2 -C /opt
cd /opt/php-5.6.11/

[root@localhost php-5.6.11]# ./configure \
> --prefix=/usr/local/php5 \ //Specify installation path
> --with-gd \  //gd library, image processing
> --with-zlib \   //function library
> --with-apxs2=/usr/local/httpd/bin/apxs \  //Providing functional modules for apache
> --with-mysql=/usr/local/mysql \  //Associated database
> --with-config-file-path=/usr/local/php5 \  //Associated PHP configuration
> --enable-mbstring   //Functional module loading

11. Compile, install and make soft links

[root@localhost php-5.6.11]#make
[root@localhost php-5.6.11]#make install
Installing PEAR environment:      /usr/local/php5/lib/php/
[PEAR] Archive_Tar    - installed: 1.3.12
[PEAR] Console_Getopt - installed: 1.3.1
[PEAR] Structures_Graph- installed: 1.0.4
[PEAR] XML_Util       - installed: 1.2.3
[PEAR] PEAR           - installed: 1.9.5
Wrote PEAR system config file at: /usr/local/php5/etc/pear.conf
You may want to add: /usr/local/php5/lib/php to your php.ini include_path
/opt/php-5.6.11/build/shtool install -c ext/phar/phar.phar /usr/local/php5/bin
ln -s -f phar.phar /usr/local/php5/bin/phar
Installing PDO headers:          /usr/local/php5/include/php/ext/pdo/

[root@localhost php-5.6.11]# cp php.ini-development /usr/local/php5/php.ini
//Copy the configuration file to php.ini
[root@localhost php-5.6.11]# ln -s /usr/local/php5/bin/* /usr/local/bin / make a soft link for all commands of php5
[root@localhost php-5.6.11]# ln -s /usr/local/php5/sbin/* /usr/local/sbin/

[root@localhost php-5.6.11]# vim /etc/httpd.conf 
<IfModule dir_module>
    DirectoryIndex index.html index.php   
</IfModule>//Default homepage plus php

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps//Add PHP configuration file

12. Enter the web page configuration file, PHP

[root@localhost php-5.6.11]# cd /usr/local/httpd/htdocs/
root@localhost htdocs]# mv index.html index.php

vi /usr/local/httpd/htdocs/index.php
<?php
phpinfo();
?>
[root@localhost htdocs]# ls
index.php

13. Our LAMP architecture is good

14. Configuration database

[root@localhost ~]# cd /mnt / / our forum package is in our previous source package. Please send me a private message.
[root@localhost mnt]# ls
apr-1.6.2.tar.gz         httpd-2.4.29.tar.bz2  php-5.6.11.tar.bz2
apr-util-1.6.0.tar.gz    LAMP-php5.6.txt
Discuz_X2.5_SC_UTF8.zip  mysql-5.6.26.tar.gz

[root@localhost mnt]# mysql -u root -p / / enter the database
Enter password:     //Enter your password abc123
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.26 Source distribution

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> create database bbs;   //Create database
Query OK, 1 row affected (0.00 sec)

mysql> show databases; //view the database
+--------------------+
| Database           |
+--------------------+
| information_schema |
| bbs                |
| mysql              |
| performance_schema |
| test               |
+--------------------+
5 rows in set (0.02 sec)

mysql> GRANT all ON bbs.* TO 'bbsuser'@'192.168.102.166' IDENTIFIED BY 'admin123';  //Upgrade the authority to all forms in the BBS database, to bbsuser users, to all terminals to log in, and set the password admin123
Query OK, 0 rows affected (0.01 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> exit  //Sign out
Bye

15. Unzip the forum package to opt

[root@localhost htdocs]# cd /mnt
[root@localhost mnt]# ls
apr-1.6.2.tar.gz         httpd-2.4.29.tar.bz2  php-5.6.11.tar.bz2
apr-util-1.6.0.tar.gz    LAMP-php5.6.txt
Discuz_X2.5_SC_UTF8.zip  mysql-5.6.26.tar.gz
[root@localhost mnt]#Discuz? X2.5? SC? Utf8. Zip - D / OPT / DIS / / extract the forum package to OPT.
  creating: /opt/dis/utility/oldprg/uchome/
  inflating: /opt/dis/utility/oldprg/uchome/invite.php  
  inflating: /opt/dis/utility/oldprg/uchome/space.php  
  inflating: /opt/dis/utility/restore.php  
  inflating: /opt/dis/utility/update.php  

[root@localhost mnt]#cd /opt/dis
[root@localhost dis]#cp -r upload/ /usr/local/httpd/htdocs/bbs / / / / / copy everything from the website to the apache site and name it bbs
[root@localhost bbs]# cd /usr/local/httpd/htdocs/
[root@localhost htdocs]# ls / / check if there is a page configuration file.
bbs  index.php

16. Visit this bbs page


17. Upgrade the permissions of program users

[root@localhost htdocs]# cd bbs/
[root@localhost bbs]# ls -l
//Total dosage 76
-rw-r--r--.  1 root root 2603 10 Month 2010:13 admin.php
drwxr-xr-x. 11 root root  163 10 Month 2010:13 api
-rw-r--r--.  1 root root  727 10 Month 2010:13 api.php
drwxr-xr-x.  2 root root   23 10 Month 2010:13 archiver
drwxr-xr-x.  2 root root   90 10 Month 2010:13 config
-rw-r--r--.  1 root root  922 10 Month 2010:13 connect.php
-rw-r--r--.  1 root root  253 10 Month 2010:13 cp.php
-rw-r--r--.  1 root root  106 10 Month 2010:13 crossdomain.xml
drwxr-xr-x. 13 root root  216 10 Month 2010:13 data
-rw-r--r--.  1 root root 5558 10 Month 2010:13 favicon.ico
-rw-r--r--.  1 root root 2110 10 Month 2010:13 forum.php
-rw-r--r--.  1 root root  823 10 Month 2010:13 group.php
-rw-r--r--.  1 root root 1223 10 Month 2010:13 home.php
-rw-r--r--.  1 root root 5448 10 Month 2010:13 index.php
drwxr-xr-x.  5 root root   64 10 Month 2010:13 install
-rw-r--r--.  1 root root 1040 10 Month 2010:13 member.php
-rw-r--r--.  1 root root 1381 10 Month 2010:13 misc.php
-rw-r--r--.  1 root root 1757 10 Month 2010:13 plugin.php
-rw-r--r--.  1 root root  985 10 Month 2010:13 portal.php
-rw-r--r--.  1 root root  582 10 Month 2010:13 robots.txt
-rw-r--r--.  1 root root 1158 10 Month 2010:13 search.php
drwxr-xr-x. 10 root root  168 10 Month 2010:13 source
drwxr-xr-x.  6 root root   72 10 Month 2010:13 static
drwxr-xr-x.  3 root root   38 10 Month 2010:13 template
drwxr-xr-x.  6 root root   92 10 Month 2010:13 uc_client
drwxr-xr-x. 13 root root  241 10 Month 2010:13 uc_server
-rw-r--r--.  1 root root 1691 10 Month 2010:13 userapp.php
[root@localhost bbs]# chown -R daemon ./config
[root@localhost bbs]# chown -R daemon ./data
[root@localhost bbs]# chown -R daemon ./uc_client
[root@localhost bbs]# chown -R daemon ./uc_server/data
[root@localhost bbs]# 
[root@localhost bbs]# ls -l
//Total dosage 76
-rw-r--r--.  1 root   root 2603 10 Month 2010:13 admin.php
drwxr-xr-x. 11 root   root  163 10 Month 2010:13 api
-rw-r--r--.  1 root   root  727 10 Month 2010:13 api.php
drwxr-xr-x.  2 root   root   23 10 Month 2010:13 archiver
drwxr-xr-x.  2 daemon root   90 10 Month 2010:13 config
-rw-r--r--.  1 root   root  922 10 Month 2010:13 connect.php
-rw-r--r--.  1 root   root  253 10 Month 2010:13 cp.php
-rw-r--r--.  1 root   root  106 10 Month 2010:13 crossdomain.xml
drwxr-xr-x. 13 daemon root  216 10 Month 2010:13 data
-rw-r--r--.  1 root   root 5558 10 Month 2010:13 favicon.ico
-rw-r--r--.  1 root   root 2110 10 Month 2010:13 forum.php
-rw-r--r--.  1 root   root  823 10 Month 2010:13 group.php
-rw-r--r--.  1 root   root 1223 10 Month 2010:13 home.php
-rw-r--r--.  1 root   root 5448 10 Month 2010:13 index.php
drwxr-xr-x.  5 root   root   64 10 Month 2010:13 install
-rw-r--r--.  1 root   root 1040 10 Month 2010:13 member.php
-rw-r--r--.  1 root   root 1381 10 Month 2010:13 misc.php
-rw-r--r--.  1 root   root 1757 10 Month 2010:13 plugin.php
-rw-r--r--.  1 root   root  985 10 Month 2010:13 portal.php
-rw-r--r--.  1 root   root  582 10 Month 2010:13 robots.txt
-rw-r--r--.  1 root   root 1158 10 Month 2010:13 search.php
drwxr-xr-x. 10 root   root  168 10 Month 2010:13 source
drwxr-xr-x.  6 root   root   72 10 Month 2010:13 static
drwxr-xr-x.  3 root   root   38 10 Month 2010:13 template
drwxr-xr-x.  6 daemon root   92 10 Month 2010:13 uc_client
drwxr-xr-x. 13 root   root  241 10 Month 2010:13 uc_server
-rw-r--r--.  1 root   root 1691 10 Month 2010:13 userapp.php

18. Go straight to the next step

19. Fill in your address, database name, database user name, database password, administrator password, set a 123 by yourself, others are default.

20. Enter http://192.168.136.132/bbs to enter the forum homepage directly.

21.http://192.168.136.132/bbs/admin.php go to the back end, you can enter your password and user name.

23. In your backend, you can modify it at will.

24.LAMP script

------------install Apache----The next two plug-ins are httpd2.4 Required for later versions-----
tar zxvf apr-1.6.2.tar.gz -C /opt
tar zxvf apr-util-1.6.0.tar.gz -C /opt
tar jxvf httpd-2.4.29.tar.bz2 -C /opt
mv apr-1.6.2 httpd-2.4.29/srclib/apr
mv apr-util-1.6.0 httpd-2.4.29/srclib/apr-util

yum -y install \
gcc \
gcc-c++ \
make \
pcre-devel \
expat-devel \
perl

cd httpd-2.4.29

./configure \
--prefix=/usr/local/httpd \
--enable-so \
--enable-rewrite \
--enable-charset-lite \
--enable-cgi

make && make install

cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd
vi /etc/init.d/httpd

#Chkconfig: 35 85 21 / / level 35 auto run 85th start 21th shutdown
#description: Apache is a World Wide Web server

chkconfig --add httpd //Add httpd to SERVICE manager

vi /usr/local/httpd/conf/httpd.conf  //To configure parameters in a configuration file
ServerName www.yun.com:80   //Change a name at will
Listen 192.168.136.132:80  //Monitor address write your local address

ln -s /usr/local/httpd/conf/httpd.conf /etc/   //Make a soft link and type vim /etc/httpd.conf next time.
ln -s /usr/local/httpd/bin/* /usr/local/bin/   //Make a soft link for your system to recognize

systemctl stop firewalld.service
setenforce 0

httpd -t 
apachectl -t

service httpd start
netstat -anpt | grep 80

--------------Here is the installation MYSQL-----http://mirrors.sohu.com/mysql/---

yum install ncurses-devel autoconf cmake -y  //Install environment package and Cmake Kit

cd /mnt
tar xzvf mysql-5.6.26.tar.gz -C /opt
cd /opt/mysql-5.6.26/
cmake  \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \  //Specify installation path
-DDEFAULT_CHARSET=utf8 \  //Specify character set
-DDEFAULT_COLLATION=utf8_general_ci \  //Specify character set defaults
-DEXTRA_CHARSETS=all \  //Specify extended character set
-DSYSCONFIDIR=/etc \  //Specify profile directory
-DMYSQL_DATADIR=/home/mysql/ \  //Specify the data file in the database
-DMYSQL_UNIX_ADDR=/home/mysql/mysql.sock  //Define a sock file to connect to a database file

make && make install  //Compiling languages recognized by computers, installing

cp support-files/my-default.cnf /etc/my.cnf  //Put the configuration file in

cp support-files/mysql.server /etc/init.d/mysqld  //Put the configuration file in the startup script
chmod 755 /etc/init.d/mysqld       //Add execution permission
chkconfig --add /etc/init.d/mysqld   //Add services to service manager
chkconfig  mysqld --level 35 on       //Level 35 on

echo "PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile  //Declaration calling mysql command to generate into system environment variable
source /etc/profile //Start system environment variable
echo $PATH    //Check whether the system environment variable has been added

useradd -s /sbin/nologin mysql   //Create a program user and do not let it log into the local console
chown -R mysql:mysql /usr/local/mysql/  //Promote the permissions of all users under the path

/usr/local/mysql/scripts/mysql_install_db \  //Initialize database
--user=mysql \   //Database users
--ldata=/var/lib/mysql \   //data
--basedir=/usr/local/mysql \  //Database directory
--datadir=/home/mysql  //Database storage directory

vi  /etc/init.d/mysqld  //Edit database file

basedir=/usr/local/mysql     //Specified path
datadir=/home/mysql     //Indicate where to store the database

service mysqld start     //Open database
netstat -anpt | grep 3306   //View listening port

mysqladmin -u root -p password "abc123" //Set password for root account

---------Following installation PHP------------
yum -y install \
gd \     //Image processing,
libpng \    //Support for PNG pictures
libpng-devel \
pcre \
pcre-devel \
libxml2-devel \   //Support parsing, tagging language
libjpeg-devel      //Support for jpg picture format

cd /mnt
tar xjvf php-5.6.11.tar.bz2 -C /opt   //php is just a code in the background. It's in the back end.
cd /opt/php-5.6.11/

./configure \
--prefix=/usr/local/php5 \  //Specify installation path
--with-gd \  //gd library, image processing
--with-zlib \  //function library
--with-apxs2=/usr/local/httpd/bin/apxs \  //Providing functional modules for apache
--with-mysql=/usr/local/mysql \  //Associated database
--with-config-file-path=/usr/local/php5 \  //Associated PHP configuration
--enable-mbstring   //Functional module loading

make && make install

cp php.ini-development /usr/local/php5/php.ini
ln -s /usr/local/php5/bin/* /usr/local/bin/
ln -s /usr/local/php5/sbin/* /usr/local/sbin/

vi /etc/httpd.conf //The function modules of PHP can be loaded in the apache configuration file

AddType application/x-httpd-php .php   //Add PHP configuration file
AddType application/x-httpd-php-source .phps

DirectoryIndex index.php index.html  //Default homepage plus php

vi /usr/local/httpd/htdocs/index.php
<?php
phpinfo();
?>

//Test "http://192.168.80.182/index.php" on the web page

mysql -u root -p

CREATE DATABASE bbs;  //Create a database
GRANT all ON bbs.* TO 'bbsuser'@'192.168.102.166' IDENTIFIED BY 'admin123'; //Upgrade the authority to all forms in the BBS database, to bbsuser users, to all terminals to log in, and set the password admin123
flush privileges; 

unzip /mnt/Discuz_X2.5_SC_UTF8.zip -d /opt/dis
cd /opt/dis
cp -r upload/ /usr/local/httpd/htdocs/bbs  //Copy everything from the website to the apache site and name it bbs

chown -R daemon ./config  //Give the user of this program permission promotion
chown -R daemon ./data
chown -R daemon ./uc_client
chown -R daemon ./uc_server/data

--------Next, test whether the database works normally-----
mysql -u root -p

CREATE DATABASE sky;
GRANT all ON sky.* TO 'skyuser'@'%' IDENTIFIED BY 'admin123';
flush privileges; 

<?php
$link=mysql_connect('192.168.80.193','skyuser','admin123');
if($link) echo "<h1>Success!!</h1>";
else echo "Fail!!";
mysql_close();
?>

That's all we have. If you want the source package, you have to trust me.

Posted by wake2010 on Sun, 20 Oct 2019 11:50:29 -0700