当前位置:网站首页>Tencent cloud deployment lamp_ Experience of building a station
Tencent cloud deployment lamp_ Experience of building a station
2022-07-28 20:02:00 【Confused Zha Zha Hui】
I am currently working on wechat development , During this period, there are server configurations developed by wechat , Since you want to configure the server , It is indispensable. LAMP Platform construction ( During this period, I referred to Alibaba cloud's website building tutorial , But copying is definitely impossible in Tencent cloud ) Some steps may be redundant , Understand the wrong words . So I wrote down the experience of configuration , I hope it can help the cute newcomers who just started to build a website in Tencent cloud .
Project configuration ( Here is my configuration , In operation , The actual software version shall prevail )
- operating system :CentOS 7.2 64 position
- Apache:2.4.37
- MySQL:5.6.24
- PHP:7.1.28
The basic flow
- Prepare the compilation environment
- install Apache
- install myqsl
- install php
Step one : Prepare the compilation environment
1、 Turn off the server firewall systemctl status firewalld Command to view the current firewall status .
If the status parameter of the firewall is active, The firewall is on . If the status parameter of the firewall is inactive, The firewall is closed .
If you want to temporarily shut down the firewall , Enter the command `systemctl stop firewalld`.( The next restart will restart the firewall )
If you want to permanently shut down the firewall , Enter the command `systemctl disable firewalld`.
2、 close SELinux.
i. Input getenforce Command to view the current SELinux The state of .
ii. If SELinux The status parameter is Enforcing, be SELinux Is on . If SELinux The status parameter is Disabled, be SELinux Is off .
If you want to temporarily close SELinux, Enter the command `setenforce 0`.
If you want to permanently close SELinux, Enter the command `vi /etc/selinux/config` edit SELinux The configuration file . After returning , Move cursor to `SELINUX=enforcing` This business , Press down i Key to enter edit mode , It is amended as follows `SELINUX=disabled`, Press down `Esc` key , Then input `:wq` And enter to save and close SELinux The configuration file .
iii. Restart the system to make the settings take effect .
Step two install apache
1、 Install dependency packages
yum groupinstall " Development Tools" -y
yum install libtool
yum install expat-devel pcre pcre-devel openssl-devel -y
2、 install Apache
1、 Use yum install Apache
yum install httpd -y
2、 start-up Apache service :
service httpd start
explain , Install in this way ,apache Generally installed in /etc/httpd Inside the , To be modified later httpd.conf It's just /etc/httpd/conf/httpd.conf Inside looking for
3、 Enter the command httpd -v You can see Apache Version number of .
4、 start-up Apache Service and set to start automatically .
systemctl start httpd
systemctl enable httpd
Step three install mysql
1. Prepare the compilation environment .
yum install ncurses-devel bison gnutls-devel -y
yum install cmake -y
2. Get ready MySQL Data storage directory .
cd
mkdir /mnt/data
groupadd -r mysql
useradd -r -g mysql -s /sbin/nologin mysql
id mysql
3. Change the master and group of the data directory .
chown -R mysql:mysql /mnt/data
4. Download the stable source package, decompress and compile .
wget https://downloads.mysql.com/archives/get/file/mysql-5.6.24.tar.gz
tar xvf mysql-5.6.24.tar.gz -C /usr/local/src
cd /usr/local/src/mysql-5.6.24
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_DATADIR=/mnt/data \
-DSYSCONFDIR=/etc \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DWITH_SSL=system \
-DWITH_ZLIB=system \
-DWITH_LIBWRAP=0 \
-DMYSQL_TCP_PORT=3306 \
-DDEFAULT_CHARSET=utf8 \
-DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_SYSTEMD=1 \
-DINSTALL_SYSTEMD_UNITDIR=/usr/lib/systemd/system
make && make install
5. Change the group of the installation directory to mysql.
chown -R mysql:mysql /usr/local/mysql/
6. Initialize the database and copy the configuration file .
cd /usr/local/mysql
/usr/local/mysql/scripts/mysql_install_db --user=mysql --datadir=/mnt/data/
mv /etc/my.cnf /etc/my.cnf.bak
cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf
7. Modify the installation path and data directory storage path in the configuration file .
echo -e "basedir = /usr/local/mysql\ndatadir = /mnt/data\n" >> /etc/my.cnf
8. Enter the command vi /usr/lib/systemd/system/mysql.service open MySQL The startup profile for , Press down i key , Then write down the following :
[Unit]
Description=MySQL Community Server
After=network.target
After=syslog.target
[Install]
WantedBy=multi-user.target
Alias=mysql.service
[Service]
User=mysql
Group=mysql
PermissionsStartOnly=true
ExecStart=/usr/local/mysql/bin/mysqld
TimeoutSec=600
Restart=always
PrivateTmp=false
Press down Esc key , Then input :wq And enter to save and close MySQL Startup profile .
9. Set up PATH environment variable .
echo "export PATH=$PATH:/usr/local/mysql/bin" > /etc/profile.d/mysql.sh
source /etc/profile.d/mysql.sh
10. start-up MySQL Service and set up boot .
systemctl start mysql
systemctl enable mysql
11. modify MySQL Of root User password . Run the following command , And set the password according to the interface prompt .
mysqladmin -u root password
12. Test login MySQL database .
mysql -uroot -p
13. function \q sign out MySQL.
Step four install php
Use yum install PHP:
yum install php php-mysql -y
test PHP Is the installation successful
We are /var/www/html Create one in the directory info.php File to check php Is the installation successful , The sample code reference is as follows
Sample code :/var/www/html/info.php
<?php phpinfo(); ?>
restart Apache service :
systemctl restart httpd.service
here , visit http://< Your CVM IP Address >/info.php You can browse to the info.php Page ( If the construction is successful , After visiting, the following interface appears )
If the above still doesn't work , Please continue to check my main reference resources .
Source of resources :
1、https://help.aliyun.com/document_detail/50774.html?spm=5176.doc52954.6.722.t92kLG( Alicloud builds LAMP)
2、https://www.cnblogs.com/feige1314/p/6957876.html( Tencent cloud build LAMP, Maybe just based on this , But I made an error when configuring )
边栏推荐
- 云计算笔记part.1——系统管理
- MySQL 8 creates master-slave replication based on Clone
- [network] communication across regional networks learn how routing tables work
- 你知道雨的类型有几种?
- 远光软件获得阿里云产品生态集成认证,携手阿里云共建新合作
- This customized keyboard turns me on~
- How does app automated testing achieve H5 testing
- 并发程序设计,你真的懂吗?
- Thoroughly understand bit operations - shift left, shift right
- Amazon launched Amazon one palm payment system, and the contactless palm vein recognition market is expected to explode
猜你喜欢

Basic concept and essence of Architecture

Servlet学习笔记

Thoroughly understand bit operations -- and (&), not (~), or (|), XOR (^)

The results of the second quarter online moving people selection of "China Internet · moving 2022" were announced

What is the process of swing event processing?

Overcome the "fear of looking at teeth", and we use technology to change the industry

Cloud computing notes part.1 - system management

2022年下半年系统集成项目管理工程师认证8月20日开班

通信网络基础知识01

Question bank and answers of the latest national fire-fighting facility operators (intermediate fire-fighting facility operators) in 2022
随机推荐
Cloud computing notes part.1 - system management
XOR operation and its usage
Leetcode day2 连续出现的数字
Know small and medium LAN WLAN
2022年下半年系统集成项目管理工程师认证8月20日开班
Implementation of strcat in C language
Leetcode Day5 delete duplicate email
leetcode day5 删除重复的电子邮箱
Idea properties file display \u solution of not displaying Chinese
Const pointer of C language and parameter passing of main function
11. Learn MySQL union operator
Stories of Party members | Li qingai uses cartoons to drive farmers to increase income and become rich
The results of the second quarter online moving people selection of "China Internet · moving 2022" were announced
C language functions and pointers
Serial port receiving application ring buffer
MySQL8 Encrypting InnoDB Tablespaces
Redis notes
C language function
Leetcode day3 find duplicate email addresses
Function fitting based on MATLAB