如何在ubuntu14.04 LTS上安装Octopress
时间:2019-08-20 17:58:17 来源:igfitidea点击:
Octopress是一个基于jekyll的框架。它有很多特点。最好的部分是,它是静态站点生成器。许多网站和博客已迁移到Octopress。
在ubuntu14.04 LTS上安装Octopress步骤:
切换到超级用户
登录Ubuntu系统后,打开终端并切换到超级用户。
sudo su -
现在我们使用 root登录。
切换目录到/opt
切换到目录/opt
cd /opt
安装ruby
为了安装ruby,我们将在这里使用ruby版本管理器(RVM)。俗称rvm。
使用rvm,我们可以安装多个ruby版本,并轻松切换到不同的ruby版本。
先安装 curl
apt-get install curl
现在 安装RVM
curl -sSL https://get.rvm.io | bash -s stable
运行脚本rvm.sh
脚本rvm.sh将会设置环境
source /etc/profile.d/rvm.sh
安装ruby需求包
rvm requirements
安装最新的ruby版本
rvm install 2.1.2
设置ruby的默认版本
rvm use 2.1.2 --default
检查ruby版本
ruby -v
安装nodejs
安装nodejs。如果缺少它,将会出现javascript运行时错误。
apt-get install nodejs
安装git
用于从github克隆octopress代码
apt-get install git
使用Git克隆octopress代码
从github复制octopress git库
git clone git://github.com/imathis/octopress.git octopress
安装Octopress及其要求包
cd octopress gem install bundler bundle install
安装默认octopress主题
安装octopress的defualt主题。
rake install
启动Rail服务器
现在我们将启动rail服务器。
octopress的端口是4000
rake preview
打开另一个终端并运行netstat命令,查看4000端口号是否为侦听状态
netstat -tanp|grep 4000
测试
打开web浏览器并键入URL
http://127.0.0.1:4000