liunx下面一步步搭建个人博客系统
偷懒了 。 大部分都是用 history 命令查到的历史命令然后贴出来的
一步步搭建个人博客系统。下面的都是我使用过的命令。
1 yum -list java*
2 yum -y list java*
3 rpm -qa|grep java
4 yum -y install wget
7 wget https://download.oracle.com/otn/java/jdk/8u231-b11/5b13a193868b4bf28bcb45c792fce896/jdk-8u231-linux-x64.tar.gz?AuthParam=1576995040_f499b27a713890d0a39575b4aec86ae0
8 yum -y list jdk*
9 yum -y list java*
10 yum -y install java-1.8.0-openjdk-devel.x86_64
11 java
12 javac
13 vim /etc/profile
************************************************************
加入下面的环境设置:
#set java environment
export JAVA_HOME=/usr/lib/jvm/java
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/jre/lib/rt.jar
export PATH=$PATH:$JAVA_HOME/bin
****************************************************************
14 source /etc/profile //刷新
15 echo $JAVA_HOME
16 echo $CLASSPATH
17 java -version
18 javac
24 yum -y list tomcat*
25 mkdir /usr/local/tomcat
26 cd /usr/local/tomcat
27 ll
28 tar -zxvf apache-tomcat-9.0.30.tar.gz
29 ll
30 cd apache-tomcat-9.0.30
31 ll
32 cd bin
33 ll
34 sh startup.sh
35 sh shutdown.sh
36 service tomcat status
37 sh startup.sh
38 ./shutdown.sh
39 ps -ef|grep java
40 cd /usr/local/tomcat/apache-tomcat-9.0.30/conf
41 vi server.xml
****************************************************************************
检查这里:
<!-- A "Connector" represents an endpoint by which requests are received
and responses are returned. Documentation at :
Java HTTP Connector: /docs/config/http.html
Java AJP Connector: /docs/config/ajp.html
APR (HTTP/AJP) Connector: /docs/apr.html
Define a non-SSL/TLS HTTP/1.1 Connector on port 8080
-->
<Connector port="80" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
<!-- A "Connector" using the shared thread pool-->
<!--
<Connector executor="tomcatThreadPool"
port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
*********************************************************************
42 cd /usr/local/tomcat/apache-tomcat-9.0.30/bin
43 ll
44 sh startup.sh
45 ll
46 cd ~
47 rpm -qa|grep mysql*
48 yum -y list mysql*
49 yum -y install mysql-server.x86_64
50 rpm -qa|grep mysql*
51 mysql -version
52 cd /var/lib/mysql
53 ll
54 chown mysql:mysql -R /dat/var/lib/mysqla/mysql
55 chown mysql:mysql -R /var/lib/mysql
56 vim /etc/my.cnf
57 netstat -lntp | grep 80
58 cd /usr/local/mysql
59 cd /usr
60 ll
61 cd local
62 ll
63 cd /var
64 ll
65 systemctl start mysqld
66 grep password /var/log/mysqld.log
67 systemctl start mysqld
68 systemctl status mysqld
******************************
修改了数据库密码
69 mysql -u root -p
70 /var/log/mysqld.log
71 vi /var/log/mysqld.log
进入数据库后创建和博客相关的数据库。
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| halodb | //创建的和博客相关的数据库 名称在查看博客数据文档时有提示
| information_schema |
| mysql |
| performance_schema |
| sys
******************************************************
72 mysql
73 cd /usr/local/
74 ll
75 iava -$PATH
76 echo $JAVA_HOME
77 whereis java
78 echo $PATH
79 mysql
80 vi /etc/my.cnf
83 service mysqld restart
84 service mysqld status
85 find mysql
86 cd /usr/bin
87 ll
88 ./mysql -uroot -p
89 vi /etc/my.cnf
90 service mysqld restart
91 service mysqld status
92 mysql
93 mysql -u root -p
安装博客运行需要的语言框架:
94 sudo yum install git-core
95 cd /usr/local/
96 ll
97 cd node
98 ll
99 tar -xvf node-v12.14.1-linux-x64.tar.xz node-v12.14.1-linux-x64/
100 systemctl start mysqld
101 -o ~/.halo/application.yaml --create-dirs http://halo.ryanc.cc/config/application-template.yaml
106 curl -o ~/.halo/application.yaml --create-dirs http://halo.ryanc.cc/config/application-template.yaml
107 vim ~/.halo/application.yaml
******************************************
文件里面的内容;
server:
port: 8090
spring:
datasource:
type: com.zaxxer.hikari.HikariDataSource
# H2 Database 配置,如果你需要使用 MySQL,请注释掉该配置并取消注释 MySQL 的>配置。
# driver-class-name: org.h2.Driver
#url: jdbc:h2:file:~/.halo/db/halo
#username: admin
#password: 123456
# MySQL 配置,如果你需要使用 H2Database,请注释掉该配置并取消注释上方 H2Database 的配置。
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/halodb?
#数据库的密码和链接方式 提别要注意名字和密码
characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
username: root
password:
# H2 Database 的控制台相关配置,如果你使用的是 MySQL ,请注释掉下方内容。
# h2:
# console:
# settings:
# web-allow-others: false
# path: /h2-console
# enabled: false
***************************************************
108 cd /usr/local/
109 ll
************************************************************
安装halo博客
110 mkdir halo
111 ll
112 cd halo/
113 wget http://halo.ryanc.cc/release/halo-latest.jar -O halo-latest.jar
114 java -jar halo-latest.jar
115 java -version
116 java -jar halo-latest.jar
117 cd ~
119 cd /var
120 ll
121 cd ~
122 cd /usr/local/
123 ll
124 cd halo/
125 ll
126 sudo curl -o /etc/systemd/system/halo.service --create-dirs http://halo.ryanc.cc/config/halo.service
127 sudo vim /etc/systemd/system/halo.service
***************************************************
运行博客:(我运行时失败了多出,原因时数据库密码导致的)
128 java -jar halo-latest.jar
129 sudo vim /etc/systemd/system/halo.service
130 java -jar halo-latest.jar
131 sudo vim /etc/systemd/system/halo.service
132 java -jar halo-latest.jar
133 find ~/.halo
134 vim ~/.halo/application.yaml
135 java -jar halo-latest.jar
136 vi /etc/my.cnf
139 vim ~/.halo/application.yaml
140 java -jar halo-latest.jar
个人博客系统搭建并运行成功
里面还有些小问题,后期修改。