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
- Buy an ECS of CentOS 6 and a domain name you like (by the way, advertise Alibaba cloud, the old owner) click here
- Download the MySQL 5.7 RPM package of RedHat6 click here
- Download Tomcat9 click here
- 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 xxx.zip [email protected]:/root/ #Install rpm package rpm -i mysql-community-common-5.7.xxx.el6.x86_64.rpm rpm -i mysql-community-client-5.7.xxx.el6.x86_64.rpm rpm -i mysql-community-server-5.7.xxx.el6.x86_64.rpm 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 unzip apache-tomcat-9.xxx.zip mv apache-tomcat-9.xxx /
2. Modify the configuration file
#Change the default 8080 port to 80 port sed -i "s/8080/80/g" /apache-tomcat-9.xxx/conf/server.xml
3 operation
cd /apache-tomcat-9.xxx/bin sh startup.sh # shutdown.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 / apache-tomcat-9.xxx/logs. If you don't understand it, I don't say it
4 install the roller
1 prepare the configuration file
mkdir /rollerdata vim /apache-tomcat-9.xxx/lib/roller-custom.properties #See the notes at the end of the article for details
2 deployment
#Unzip file unzip roller-release-5.1.2-standard.zip #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 /apache-tomcat-9.xxx/webapps/ cp mysql-connector-java-5.1.xxx.jar mail.jar activation.jar /apache-tomcat-9.xxx/lib/ #Wait a moment, a roller directory will appear in / apache-tomcat-9.xxx/webapps cd /apache-tomcat-9.xxx/webapps mv ROOT tomcat_home mv roller ROOT rm roller.war sh /apache-tomcat-9.xxx/bin/shutdown.sh sh /apache-tomcat-9.xxx/bin/startup.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 /apache-tomcat-9.xxx/webapps/ROOT/themes/gaurav 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">, Modify the content and replace the foreign website with the following code`.
<div id="ckepop"> <a>WeChat</a> <a href="http://www.jiathis.com/share" class="jiathis jiathis_ txt jiathis_ separator jtico jtico_ jiathis" target="_ Blank "> more</a> <a></a> </div> <script type="text/javascript" src="http://v3.jiathis.com/code/jia.js?uid=1" charset="utf-8"></script> </div>
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)( http://114.215.30.221/main/mediaresource/499fc5a7-83dc-47e9-8b7f-0f241dee4e87 )]
- 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.
- The OSS command line interface is simple to use and can easily upload pictures in batches.
- OSS supports flexible separate traffic billing.
- 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.
- If necessary, you can use CDN to improve the image access performance.
- The disadvantage is that it costs money! It costs money! It costs money!
7 Notes
- my.cnf
[mysqld_safe] pid-file=/mysql/run/mysqld.pid [mysql] port=3306 prompt=\\u@\\d \\r:\\m:\\s> default-character-set=utf8mb4 [mysqld] basedir=/mysql datadir=/mysql/data tmpdir=/mysql/tmp lc_messages_dir=/usr/share/mysql log-error=/mysql/log/alert.log slow_query_log_file=/mysql/log/slow.log general_log_file=/mysql/log/general.log socket=/mysql/run/mysql.sock #innodb innodb_data_home_dir=/mysql/data innodb_log_group_home_dir=/mysql/data innodb_data_file_path = ibdata1:1G;ibdata2:16M:autoextend innodb_log_file_size=512M innodb_log_buffer_size=200M innodb_buffer_pool_size=256M #myisam concurrent_insert=2 delayed_insert_timeout=300 #binlog log-bin=/mysql/log/mysql-bin #server default-storage-engine=INNODB character-set-server=utf8mb4 server_id=2573750487
- roller-custom.properties
installation.type=auto mediafiles.storage.dir=/rollerdata/mediafiles search.index.dir=/rollerdata/searchindex log4j.appender.roller.File=/rollerdata/roller.log database.configurationType=jdbc database.jdbc.driverClass=com.mysql.jdbc.Driver database.jdbc.connectionURL=jdbc:mysql://localhost:3306/rollerdb?autoReconnect=true&useUnicode=true&characterEncoding=utf-8&mysqlEncoding=utf8 database.jdbc.username=rollerdb database.jdbc.password=xxx mail.configurationType=properties mail.hostname=smtp.126.com [email protected] mail.password=xxx