###Ubuntu下配置和运行本博客指南 (Windows上基本类似)
######1 安装配置Golang
-
1.1 移除已经存在的老版本(安装的过程反过来做)
-
1.2 下载golang压缩包[fileName] 下载地址
-
1.3 解压缩安装
sudo tar -C /usr/local -xzf [fileName] //[fileName]是官网下载的golang压缩包
- 1.4 配置环境变量
sudo gedit /etc/profile
添加配置到profile文件末尾并保存: export GOROOT=/usr/local/go //安装目录 export GOPATH=[yourOwnGopath] //[yourOwnGopath]是自己选择的golang项目目录 export PATH=$PATH:${GOPATH//://bin:}/bin:$GOROOT/bin
######2 安装配置Beego Blog
- 2.1 Git安装
sudo apt-get install git
- 2.2 克隆本博客
cd $GOPATH/src git clone https://github.com/hopehook/beegoblog.git
- 2.3 获取外部依赖包
go get github.com/astaxie/beego go get github.com/Unknwon/com go get github.com/mattn/go-sqlite3 go get github.com/garyburd/redigo/redis
######3 运行本博客
- 3.1 编译和运行
go build $GOPATH/src/beegoblog/main.go ./main
- 3.2 浏览器查看
firefox http://localhost:8080
######4 启用Redis替换SQLite
- 4.1 安装Redis
sudo apt-get update sudo apt-get install redis-server
- 4.2 运行Redis
sudo redis-server sudo redis-cli
- 4.3 配置Redis
sudo CONFIG SET requirepass 123
- 4.4 替换SQLite
sudo gedit $GOPATH/src/beegoblog/conf/app.conf
添加配置到app.conf文件末尾并保存: database = redis requirepass = 123 //Redis验证密码,与4.3保持一致即可
######0 总体
html/JS/CSS + golang + DB
######1 UI
AngularJS + jQuery
######2 后台
Beego
######3 数据库
SQLite | Redis