当前位置:网站首页>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 )
边栏推荐
- 时间转日期的sql语句应该怎么写?
- The cloud native programming challenge is hot, with 510000 bonus waiting for you to challenge!
- MySQL性能测试工具sysbench学习
- MySQL8 tmp_ table_ Size and Max_ heap_ table_ size
- C language functions and pointers
- [NPP installation plug-in]
- NetCoreAPI操作Excel表格
- JS batch add event listening onclick this event delegate target currenttarget onmouseenter OnMouseOver
- Digital filter design matlab
- Data system of saltstack
猜你喜欢

Article translation software - batch free translation software supports major translation interfaces

KubeEdge发布云原生边缘计算威胁模型及安全防护技术白皮书

English Translation Spanish - batch English Translation Spanish tools free of charge

一文读懂如何部署具有外部数据库的高可用 K3s

Edge detection and connection of image segmentation realized by MATLAB

Deploy LNMP automatically with saltstack

Can China make a breakthrough in the future development of the meta universe and occupy the highland?

架构基本概念和架构本质

MATLAB实现的图像分割之边缘检测和连接

认识中小型局域网WLAN
随机推荐
Oracle insert数据时字符串中有‘单引号问题
MySQL8 Status Variables: Internal Temporary Tables and Files
Sequential linear table - practice in class
C language operators and input and output
Information management system and games based on C language
Codeignier framework implements restful API interface programming
Left alignment function of Lua language (handwriting)
Labelme (I)
Thoroughly understand bit operations -- and (&), not (~), or (|), XOR (^)
C language array and bubble sort
Hebei: stabilizing grain and expanding beans to help grain and oil production improve quality and efficiency
河北:稳粮扩豆助力粮油生产提质增效
[网络]跨区域网络的通信学习IPv4地址的分类和计算
一文读懂如何部署具有外部数据库的高可用 K3s
MySQL 8 creates master-slave replication based on Clone
Stories of Party members | Li qingai uses cartoons to drive farmers to increase income and become rich
[experience] some suggestions and experience on repairing electronic equipment
Crawl IP
个人博克系统登录点击图形验证码的集成与实现
云计算笔记part.2——应用管理