Building process of Roller blog system

0 Preface

The process of building the Roller blog system of the inventory blog, although the Roller is old-fashioned and about to become obsolete, it is still very practical. No way, just like this ancient and exquisite thing. That is, because Roller doesn't have so many fancy functions, it will be more stable and simple and convenient for deployment, use and operation and maintenance.

1. Prepare resources

  1. Buy an ECS of CentOS 6 and a domain name you like (by the way, advertise Alibaba cloud, the old owner) click here
  2. Download the MySQL 5.7 RPM package of RedHat6 click here
  3. Download Tomcat9 click here
  4. Download Roller5 click here

2 deployment database

1 after extracting the downloaded files, install the following installation packages in turn

#Transfer the downloaded files to ECS
scp xxx.rpm root@
#Install rpm package
rpm -i
rpm -i
rpm -i

Note: xxx Represents a small version number, which needs to be replaced according to the actual version number. There will be no repeated reminders later.

2. The steps to initialize and start mysql after installation are

#Initialize database file
mkdir /mysql
cd /mysql && mkdir data log tmp run 
mysqld --initialize-insecure --user=mysql --basedir=/mysql --datadir=/mysql/data --innodb-data-file-path='ibdata1:1G;ibdata2:16M:autoextend' --innodb-log-file-size=512M
chown -R mysql:mysql /mysql 

#Database configuration
vim my.cnf #See the notes at the end of the article for details

#Start database
/bin/sh /usr/bin/mysqld_safe --defaults-file=/mysql/my.cnf --read_only=0 &

3 initialize database

#Login database
mysql --socket=/mysql/run/mysql.sock -uroot 
#Execute database building and authorization sql
create database rollerdb character set utf8mb4; #Set to utf8mb4 to support emoticon characters 😋
grant all on rollerdb.* to rollerdb@'%' identified by 'xxx';
grant all on rollerdb.* to rollerdb@'LOCALHOST' identified by 'xxx';
flush privileges;

3. Deploy tomcat

1 extract the file

#Install java
yum install java-1.8.0-openjdk.x86_64 
#Unzip the downloaded tomcat
mv /

2. Modify the configuration file

#Change the default 8080 port to 80 port
sed -i "s/8080/80/g" / 

3 operation

cd /
sh # is the shutdown script
# Check whether there is a tomcat process running
ps aux | grep tomcat
# After successful startup, the browser opens your own domain name and you can see the welcome page of tomcat.
# If there is a problem, you can find clues in / If you don't understand it, I don't say it

4 install the roller

1 prepare the configuration file

mkdir /rollerdata
vim / #See the notes at the end of the article for details

2 deployment

#Unzip file
#The deployment files and the three jar packages that roller relies on can be downloaded from google
cp roller-release-5.1.2/webapp/roller.war /
cp mail.jar activation.jar /
#Wait a moment, a roller directory will appear in /
cd /
mv ROOT tomcat_home
mv roller ROOT
rm roller.war
sh / 
sh / 

3 now you can open your domain name to start and use Roller. Follow the prompts to initialize step by step. If you encounter an error during initialization, you can restart tomcat and try again. After completion, you will have your own blog system. Do you start to get a little excited about the scene that advertisers chase after you and put money behind your ass one day.

5 optimization

After I chose to use the gaurav theme, I found that many places were not completely sinicized, and the display of half Chinese and half English made people feel like eating flies.

#Modify subject copy
cd /
grep *.vm "Welcome" #Search for documents to be modified
sed -i "s/Welcome/Welcome to subscribe/g" entry.vm #Replace with the copy you want
#Restart tomcat

2. The old sharing buttons are foreign websites that you don't know very well. You can replace the sidebar by modifying the themes/entry.vm file_ Content to share with wechat circle of friends and other domestic mainstream social platforms.

vim open entry.vm ,Locate to <div id="sidebar_content" class="col-lg-4">, 
Modify the content and replace the foreign website with the following code`. 
<div id="ckepop">
<a class="jiathis_button_weixin">WeChat</a> 
<a href=""  class="jiathis jiathis_ txt jiathis_ separator jtico jtico_ jiathis" target="_ Blank "> more</a>
<a class="jiathis_counter_style"></a> </div> 
<script type="text/javascript" src="" charset="utf-8"></script>

6. Use MarkDown and OSS together

  • After selecting Xinha, the editor can cooperate with MarkDown to realize convenient article editing. You only need to copy the edited HTML content to the editing box of Roller.

[external chain picture transfer failed. The source station may have anti-theft chain mechanism. It is recommended to save the picture and upload it directly (img-lt8nzm3g-1633408146297)( )]

  • Using Roller to manage image files directly, uploading them one by one is really troublesome, and images waste too much traffic. If there are too many images, there is too much waste of time. I love you, and it is not cost-effective to buy a higher ECS. You can solve this problem by purchasing Alibaba cloud OSS.
    1. The OSS command line interface is simple to use and can easily upload pictures in batches.
    2. OSS supports flexible separate traffic billing.
    3. The data in OSS is redundant. You don't have to be afraid of losing pictures after the machine breaks down. The data in MySQL can also be backed up regularly on OSS.
    4. If necessary, you can use CDN to improve the image access performance.
    5. The disadvantage is that it costs money! It costs money! It costs money!

7 Notes

  • my.cnf

prompt=\\u@\\d \\r:\\m:\\s>

innodb_data_file_path = ibdata1:1G;ibdata2:16M:autoextend

Tags: Database MySQL Tomcat

Posted on Wed, 06 Oct 2021 17:09:18 -0400 by mighty