当前位置:网站首页>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 .
边栏推荐
- JS get data
- User management and permissions
- Solidity contract address to wallet, wallet address to contract
- Analysis on market scale and supply of China's needle coke industry in 2020 [figure]
- Leetcode-78-subset
- R语言使用DALEX包的model_profile函数基于条件依赖CDP方法解释多个分类模型中某个连续特征和目标值y的关系(Conditional Dependence Plots)
- Training of long and difficult sentences in postgraduate entrance examination day83
- Idea common plug-ins
- Genicam gentl standard ver1.5 (1)
- 如何快速关闭8080端口
猜你喜欢

Embark on a new journey and reach the world with wisdom

Tiger Dao VC products are officially launched, a powerful supplement to seektiger ecology
![Analysis on the development trend of China's intense pulsed light equipment industry in 2021: the market scale is growing, and the proportion of imported brands is large [figure]](/img/15/4477a850044136bb4b1ee92ab6df45.jpg)
Analysis on the development trend of China's intense pulsed light equipment industry in 2021: the market scale is growing, and the proportion of imported brands is large [figure]

QQ机器人疫情查询/疫情关注等【最新beta2版本】
![Analysis on policy, output and market scale of China's natural gas hydrogen production industry in 2020 [figure]](/img/f2/ec0fe8bec503c8788d6d549845b95c.jpg)
Analysis on policy, output and market scale of China's natural gas hydrogen production industry in 2020 [figure]

Redis 5.0 data structure double end linked list source code analysis
![Overview and trend analysis of China's CT examination equipment industry in 2021 [figure]](/img/e0/d4ed9a9d91534be0d956414f6abaaa.jpg)
Overview and trend analysis of China's CT examination equipment industry in 2021 [figure]

How to sort massive data? How to process data between memory and hard disk?

Regular expression summary
![Current situation of China's hydraulic cylinder industry in 2020 (with application fields, policies and regulations, supply and demand status and enterprise pattern) [figure]](/img/2e/439b5dce9634d4015430c9cf06c5de.jpg)
Current situation of China's hydraulic cylinder industry in 2020 (with application fields, policies and regulations, supply and demand status and enterprise pattern) [figure]
随机推荐
Overview and trend analysis of China's CT examination equipment industry in 2021 [figure]
JS get data
Apifox简单了解——WEB端测试的集大成者
Development status of China's hydrotalcite industry in 2020 and analysis of major enterprises: the market scale is rapidly increasing, and there is a large space for domestic substitution [figure]
Analysis on policy, output and market scale of China's natural gas hydrogen production industry in 2020 [figure]
Sorting out the latest data mining competition scheme!
158 Bar _ Modèle Power bi utilise Dax + SVG pour créer des diagrammes d'affaires presque toutes les possibilités
Training of long and difficult sentences in postgraduate entrance examination day84
R语言使用DALEX包的model_profile函数基于条件依赖CDP方法解释多个分类模型中某个连续特征和目标值y的关系(Conditional Dependence Plots)
solidity 合约地址转钱包、钱包地址转合约
Training of long and difficult sentences in postgraduate entrance examination day91
PHP database connection version1.1
Tiger DAO VC产品正式上线,Seektiger生态的有力补充
One night I worked as an XPath Terminator: XPath Helper Plus
QQ robot epidemic situation query / epidemic situation concern [latest beta2 version]
TCP/IP 测试题(五)
网络安全检测与防范 测试题(一)
LeetCode 322. Change exchange & dynamic planning
shell-跳出循环-shift参数左移-函数的使用
Jump jump games auxiliary (manual version) py code implementation