当前位置:网站首页>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 )
边栏推荐
- KubeEdge发布云原生边缘计算威胁模型及安全防护技术白皮书
- KPMG China: insights into information technology audit projects of securities fund management institutions
- English translation Italian - batch English translation Italian tools free of charge
- Basic concept and essence of Architecture
- English translation Portuguese - batch English conversion Portuguese - free translation and conversion of various languages
- Stories of Party members | Li qingai uses cartoons to drive farmers to increase income and become rich
- 并发程序设计,你真的懂吗?
- “中国网事·感动2022”二季度网络感动人物评选结果揭晓
- leetcode day3 超过经理收入的员工
- [in depth study of 4g/5g/6g topics -44]: urllc-15 - in depth interpretation of 3GPP urllc related protocols, specifications and technical principles -9-low delay technology -3-non slot scheduling mini
猜你喜欢

Basic knowledge of communication network 01

克服“看牙恐惧”,我们用技术改变行业

并发程序设计,你真的懂吗?

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

How many types of rain do you know?

Servlet learning notes

Basic usage of docker

Cloud computing notes part.2 - Application Management

11. Learn MySQL union operator

High beam software has obtained Alibaba cloud product ecological integration certification, and is working with Alibaba cloud to build new cooperation
随机推荐
Redis notes
editor.md中markdown编辑器的实现
Leetcode Day1 score ranking
Kubeedge releases white paper on cloud native edge computing threat model and security protection technology
云原生编程挑战赛火热开赛,51 万奖金等你来挑战!
Leetcode day4 the highest paid employee in the Department
adb remount of the / superblock failed: Permission denied
Intermediate soft test (system integration project management engineer) high frequency test site
English translation Italian - batch English translation Italian tools free of charge
“中国网事·感动2022”二季度网络感动人物评选结果揭晓
Concurrent programming, do you really understand?
Netcoreapi operation excel table
Handan, Hebei: expand grassroots employment space and help college graduates obtain employment
冲刺金九银十丨熬夜半个月汇集大厂Android岗1600道面试真题
C+ + core programming
leetcode day5 删除重复的电子邮箱
Special draft of Mir | common sense knowledge and reasoning: representation, acquisition and application (deadline on October 31)
Design of air combat game based on qtgui image interface
MATLAB实现的图像分割之边缘检测和连接
河北邯郸:拓展基层就业空间 助力高校毕业生就业