当前位置:网站首页>ECS 7-day practical training camp (Advanced route) -- day04 -- build a portal using ECs and polardb
ECS 7-day practical training camp (Advanced route) -- day04 -- build a portal using ECs and polardb
2022-06-25 19:07:00 【Student Zhao who loves learning】
Use ECS and PolarDB Building a portal
PolarDB It is a new generation of relational cloud native database independently developed by Alibaba cloud , It has the low cost advantage of distributed design , And it's centralized and easy to use . PolarDB Use storage computing to separate 、 Integrated design of hardware and software , Meet the needs of large-scale application scenarios . See Baidu Encyclopedia for details :PolarDB Baidu Encyclopedia
Today, I will do a practice of building a portal , The platform used is still the online experiment module of Alibaba training camp , I think it's very good , There are the introduction and operation steps of the experiment , It's more suitable for Xiaobai entry , In addition, you don't need to apply for it yourself Ecs resources , This platform can provide online resources , But there is a quota every day , Interested partners can learn about : Ali training camp
Don't talk much , Let's start today's experiment : First, enter the advanced route of Ali training camp ( Here, you are considered to have registered an alicloud account and passed the authentication , Of course, if you have your own server, you can follow suit ), Click to enter today's experiment
Click to enter the experiment ( Because I've done it before , So here's another experiment , Click in the same interface )
The steps of applying for resources after entering and ecs Refer to the previous tutorial for the meaning of each parameter : Quickly build Docker Environmental Science
After creating the corresponding resources, you can see that the navigation bar on the left will appear ECS Information about , At this point, we need to click one button to copy , Open it in a browser ( Tips : To create a new traceless window , Otherwise, our current number will be crowded out when we land later , Of course, it's OK to open it in another browser )
Paste login in the address bar url, visit RAM user The login page , At the login user name , Input Subuser name , single click Next click Sign in Get into Alicloud management console .

stay Home page of alicloud console Left navigation bar , In turn, click Products and services > Cloud database PolarDB , Get into Cloud database PolarDB Administrative console .

Click on the left Cluster list , Then select the region where cloud product resources are provided . for example : East China 2( Shanghai )

Create a database account .
a. stay Cluster list page , single click colony ID , Get into Cluster details screen .

b. Click on the left navigation bar Configuration and management > Account management .
c. Click on the top left Create account .

d. Refer to the instructions to configure account information , And then click determine .
Database account : Enter the database account name , for example :test_user .
Account type : Select normal account here .
password : Set account password , for example :Password1213.
Confirm the password : Enter the password again .

Create database .
a. On the instance details page , Click... On the left navigation bar Database management , And then click Create database .
b. Refer to the instructions for configuring database information , And then click establish .
database (DB) name : Enter the database name , for example :pbootcms . Character set support : Default to utf8mb4. Authorized account number : Select the database account created in the previous step test_user. Account type : The default setting is read-write . Remarks : Not required . It is used to note the information about the database , Convenient for subsequent database management , Most support 256 Characters .

Set database white list .
To connect to a database, you need to set the database white list , Click on [ Cluster whitelist ], And then click [ Set up ] Set database cluster white list .
In the whitelist interface, the default whitelist address will be displayed 127.0.0.1 Change to 0.0.0.0/0, And then click [ determine ] Make white list address effective .
Connect ECS The server
What I'm using here is xshell, Of course putty,windows Self contained cmd All can be connected , I prefer to use xshell.xhsell The connection method is not explained here . Please refer to my previous connection process : Quickly build Docker Environmental Science
An interface like this shows that you have successfully connected to the server 
install LAMP Environmental Science
LAMP Refers to the operation in Linux Under the Apache、MySQL and PHP Environment . Refer to the following operation to install the development environment on the cloud server . For details, please refer to Baidu Encyclopedia :LAMP Environmental Science
1. stay ECS Server , Perform the following installation Apache Services and their extensions .
yum -y install httpd httpd-manual mod_ssl mod_perl mod_auth_mysql
If the result similar to the figure below is returned, the installation is successful .
2. PbootCMS It's using PHP Language development CMS System . Refer to the following operation for installation PHP Environmental Science .
Execute the following command , install PHP.
yum -y install php php-mysql gd php-gd gd-devel php-xml php-common php-mbstring php-ldap php-pear php-xmlrpc php-imap

3. Execute the following command to download and install MySQL.( Here are three lines of command , You can copy and paste them separately , You can also copy and paste one piece , Then press enter )
wget http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
yum -y install mysql57-community-release-el7-10.noarch.rpm
yum -y install mysql-community-server

4. Execute the following command to start MySQL database .
systemctl start mysqld
There will be no response after the input here , To see whether the database is started successfully, you can enter the following command to view the database status , If a small green dot appears, the startup is successful , If not, try the above command again
systemctl status mysqld

Building a portal
After the environment is deployed , Refer to the following operations to build a portal .
1. stay ECS Server , Execute the following command , install Git.
yum -y install git

2. stay ECS Server , Execute the following command to download PbootCMS The source code file .
cd ~ && git clone https://gitee.com/hnaoyun/PbootCMS.git

3. Execute the following command to copy the installation package to Apache Of wwwroot Under the table of contents .
cp -r PbootCMS/* /var/www/html/
There will be no prompt after the input here
4. Execute the following command to modify the site root file permissions .
chmod -R a+w /var/www/html
There will be no prompt after input
- Import... Into the database CMS The initial data .
Execute the following command to initialize the database pbootcms The table structure and data of .
explain : Before executing the order , Please modify the three parameters .
See the link address section at the bottom of the cluster details page for the database connection address .
test_user For the database account created in step 2 .
Password1213 The database password created in step 2 .
sql_file="/var/www/html/static/backup/sql/"$(ls
/var/www/html/static/backup/sql/) && mysql -h Database connection address -utest_user
-pPassword1213 -Dpbootcms < $sql_file

This step is easy to make mistakes , In particular, the database user name was created earlier 、 Students whose passwords and table names are different from mine , Here I divide it into four parts : The first part is your database link , You can find... Here 
The second and third parts are the user name and password for creating the database , The user name and password can be set by yourself , You can find it here , If you forget your password, you can reset it here

The fourth part is the database name , You can find... Here

5. Execute the following command , modify CMS System database configuration .
explain : Before executing the order , Please replace your database configuration according to the parameter description .
cat > /var/www/html/config/database.php << EOF <?php return array(
‘database’ => array(
‘type’ => ‘mysqli’, // Database connection driver type : mysqli,sqlite,pdo_mysql,pdo_sqlite
‘host’ => ‘ Database connection address ’, // PolarDB Database link address
‘user’ => ‘test_user’, // PolarDB The user name of the database
‘passwd’ => ‘Password1213’, // PolarDB Database password
‘port’ => ‘3306’, // Database port
‘dbname’ => ‘pbootcms’ // Database name
) ); EOF
6. return ECS Console , stay ECS Instance list page , Click the created ECS example ID Link to ECS Details page .
7. On the left navigation bar , single click This example security group , Then click... For the security group ID Link to view security group configuration .
Make sure the security team is open 80 Port access , Otherwise, you can't access the established portal . A security group is a kind of virtual firewall , State detection and packet filtering capabilities , Used to divide security domains in the cloud . By configuring security group rules , You can control one or more in the security group ECS The inflow and outflow of the instance .

8. Access program .
Execute the following command to restart Apache service .
systemctl restart httpd
Enter the public network of the cloud server in the browser address bar IP Address , Go to the home page of the portal .
The default access path of the system background is http://<ECS Public network IP Address >/admin.php. The default account number is admin, The password for 123456.
So far, you have completed the construction of the portal website , You can customize the content of the portal website according to the needs of the company .
summary : This experimental procedure is more complicated than the previous ones , Especially connecting to the database , Note that several parameters should be modified to their own parameters . It may not be very skilled at first , Try a few more times and you will become proficient .
边栏推荐
- 两轮市场红海,利尔达芯智行如何乘风破浪?
- TCP/IP 测试题(五)
- Regular expression summary
- 网络安全检测与防范 测试题(四)
- 削足适履 - 谈谈赛道上的坡道改造
- 158_模型_Power BI 使用 DAX + SVG 打通制作商业图表几乎所有可能
- 【C语言练习——打印上三角及其变形(带空格版)】
- On location and scale in CNN
- 158 Bar _ Modèle Power bi utilise Dax + SVG pour créer des diagrammes d'affaires presque toutes les possibilités
- Electronic basic project construction & communication between main thread and rendering thread
猜你喜欢
![Analysis on planting area, output and import of sugarcane in Guangxi in 2021: the output of sugarcane in Guangxi accounts for 68.56% of the total output of sugarcane in China [figure]](/img/c9/f2a8c3c4ddf28d96d8bfc7bc31a4fe.jpg)
Analysis on planting area, output and import of sugarcane in Guangxi in 2021: the output of sugarcane in Guangxi accounts for 68.56% of the total output of sugarcane in China [figure]

Embark on a new journey and reach the world with wisdom

华为发布两大昇腾计划 推动AI人才发展和科研创新

Combing the latest Data Mining Event Scheme!

为什么生命科学企业都在陆续上云?

揭秘GES超大规模图计算引擎HyG:图切分

158_ Model_ Power Bi uses DAX + SVG to open up almost all possibilities for making business charts

Apifox simple understanding -- the integrator of web side testing

什么是算子?

Command records of common data types for redis cli operations
随机推荐
JVM | runtime data area (heap space)
网络安全检测与防范 测试题(四)
Analysis on policy, output and market scale of China's natural gas hydrogen production industry in 2020 [figure]
Analysis on planting area, output and import of sugarcane in Guangxi in 2021: the output of sugarcane in Guangxi accounts for 68.56% of the total output of sugarcane in China [figure]
跳一跳小游戏辅助(手动版本)py代码实现
LeetCode 198. Looting & dynamic planning
最新數據挖掘賽事方案梳理!
Training of long and difficult sentences in postgraduate entrance examination day91
Combing the latest Data Mining Event Scheme!
electron 基础项目搭建 &&主线程和渲染线程的通信
Svn introduction and Usage Summary
solidity获取季度时间
Training of long and difficult sentences in postgraduate entrance examination day87
Network security detection and prevention test questions (II)
Divine reversion EA
广州华锐互动VR全景为各行各业带来发展
Training of long and difficult sentences in postgraduate entrance examination day89
User management and permissions
shell-跳出循环-shift参数左移-函数的使用
Training of long and difficult sentences in postgraduate entrance examination day84