原博内容:
rvm安装低版本ruby报错Error running ‘requirements_debian_libs_install libssl1.0-dev’,Requirements installation failed with status: 100.
由于参与的一个项目在用2.3.1版本的ruby,所以想用rvm来安装ruby2.3.1。运行报错,需要libssl1.0-dev.
解决办法:
sudo gedit /etc/apt/sources.list
在/etc/apt/sources.list
中添加下载源 deb http://security.ubuntu.com/ubuntu bionic-security main
。保存退出。
sudo apt update
apt-cache policy libssl1.0-dev #(这步我没有做,先不做)
然后再安装rvm install 2.2.6
————————————————
版权声明:本文为CSDN博主「会打滚的咸鱼」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_41988167/article/details/106202868
很多以前做过的事,细节步骤都不记得了,多写字吧,详细地记录下来,以后也有个回忆。
rake new_post["file name"]
后自动打开博客文件
编辑Rakefile
文件,上面位置,添加定义:
editor = "gedit"
然后在new_post
命令后面添加:
if #{editor}
system "#{editor} #{filename}"
end
将图片放到octopress/source/images/
下,然后在Markdown文件中可直接引用,用法:
c++
int main()
{
cout<<"hello world"<<endl;
};
rvm install 2.3.1
失败
.
cd octopress
.
ruby --version
.
rvm use 2.7.0
Required ruby-2.7.0 is not installed.
To install do: 'rvm install "ruby-2.7.0"'
.
dong@Ubuntu:~/octopress$ rvm install "ruby-2.7.0"
.
dong@Ubuntu:~/octopress$ ruby --version
ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux]
.
dong@Ubuntu:~/octopress$ rake generate
Could not find rake-10.5.0 in any of the sources
Run `bundle install` to install missing gems.
.
dong@Ubuntu:~/octopress$ bundle install
Traceback (most recent call last):
4: from /home/dong/.rvm/rubies/ruby-2.7.0/bin/ruby_executable_hooks:22:in `<main>'
3: from /home/dong/.rvm/rubies/ruby-2.7.0/bin/ruby_executable_hooks:22:in `eval'
2: from /home/dong/.rvm/rubies/ruby-2.7.0/bin/bundle:23:in `<main>'
1: from /home/dong/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/rubygems.rb:294:in `activate_bin_path'
/home/dong/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/rubygems.rb:275:in `find_spec_for_exe': Could not find 'bundler' (1.17.3) required by your /home/dong/octopress/Gemfile.lock. (Gem::GemNotFoundException)
To update to the latest version installed on your system, run `bundle update --bundler`.
To install the missing version, run `gem install bundler:1.17.3`
.
dong@Ubuntu:~/octopress$ gem install bundler:1.17.3
Fetching bundler-1.17.3.gem
Successfully installed bundler-1.17.3
Parsing documentation for bundler-1.17.3
Installing ri documentation for bundler-1.17.3
Done installing documentation for bundler after 3 seconds
1 gem installed
.
dong@Ubuntu:~/octopress$ rake generate
Could not find rake-10.5.0 in any of the sources
Run `bundle install` to install missing gems.
.
dong@Ubuntu:~/octopress$ bundle install
.
dong@Ubuntu:~/octopress$ rake generate
rake aborted!
Gem::LoadError: You have already activated rake 13.0.1, but your Gemfile requires rake 10.5.0. Prepending `bundle exec` to your command may solve this.
/home/dong/octopress/Rakefile:2:in `<top (required)>'
(See full trace by running task with --trace)
提示失败,
但是可以加上bundle exec
dong@Ubuntu:~/octopress$bundle exec rake generate
很多警告,但是成了,
下面也一样:
bundle exec rake preview
首先利用rfkill
命令查看目前无线传输设备的状态,rfkill
是一个命令行工具,可使用它查询和更改系统中启用了RFKill的设备。
rfkill的常用方法为:
rfkill list all
# 获得设备列表
rfkill block [index|type]
# 通过索引或类型禁用设备
rfkill unblock [index|type]
# 通过索引或类型启用设备
当前设备状态如下:
rfkill list all
输出:
0: phy0: Wireless LAN
Soft blocked: no
Hard blocked: yes
1: acer-wireless: Wireless LAN
Soft blocked: no
Hard blocked: no
通过rfkill启用/禁用设备无法对硬件阻塞产生作用。
由于笔记本只有一个无线网卡,这两个模块应该是有冲突
使用命令lsmod | grep acer可以看出系统启动了acer_wmi模块 |
通过查找资料后,解决方法为禁用acer_wmi模块。
ubuntu20.04安装了几次2.0都失败
ubuntu12.04已经无法安装系统本身的更新了,更别说安装其他软件
强迫症发作,于是有了这次:
git --version
sudo apt install git
git --version
github用户名
git config --global user.name "qiuhaidong"
#or haydnyau
github登录帐号邮箱名
git config --global user.email "690982322@qq.com"
#or 1148891016@qq.com
Password caching
To use this option, you need to turn on the credential helper so that git will save your password in memory for some time:
git config --global credential.helper cache
First, we need to check for existing ssh keys on your computer. Open up Terminal and run:
cd ~/.ssh
# Checks to see if there is a directory named ".ssh" in your user directory
If it says “No such file or directory” go to step 2. Otherwise, you already have an existing keypair, and you can skip to step 3.
最好就是把 .shh 这个文件夹删除了,做step 2
To generate a new SSH key, enter the code below. We want the default settings so when asked to enter a file in which to save the key, just press enter.不要输入文件名
ssh-keygen -t rsa -C "your_email@example.com"
我的就是:ssh-keygen -t rsa -C "690982322@qq.com"
#or 1148891016@qq.com
Now you need to enter a passphrase.设置密码。(有人是密码都不要的,再按两下enter就行了)
Which should give you something like this:
Your identification has been saved in /home/you/.ssh/id_rsa.
Your public key has been saved in /home/you/.ssh/id_rsa.pub.
The key fingerprint is:
01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db your_email@example.com
ctrl+h,显示隐藏文件,这里其实可以打开这个id_rsa.pub文件,直接复制,不用安装下面的软件
sudo apt-get install xclip
# Downloads and installs xclip.
xclip -sel clip < ~/.ssh/id_rsa.pub
# Copies the contents of the id_rsa.pub file to your clipboard
到github网站,登陆,头像,设置,SSH and GPG keys,把旧的SSH keys删除,添加新的,title不用管,粘贴到key就行了
ssh -T git@github.com
这里可能会还要按照提示做一下,不难,看英文做
如果看到:
Hi qiuhaidong! You've successfully authenticated, but GitHub does not provide shell access.
# or haydnyau
If that username is correct, you’ve successfully set up your SSH key. Don’t worry about the shell access thing, you don’t want that anyway.
If you see “access denied” please consider using HTTPS instead of SSH. If you need SSH start at these instructions for diagnosing the issue.
看官网命令
rvm --version
gpg2 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
会显示失败,先不管它
Install RVM:命令
curl -sSL https://get.rvm.io | bash -s stable
如下:
dong@Ubuntu:~$ curl -sSL https://get.rvm.io | bash -s stable
Downloading https://github.com/rvm/rvm/archive/1.29.12.tar.gz
Downloading https://github.com/rvm/rvm/releases/download/1.29.12/1.29.12.tar.gz.asc
gpg: 于 2021年01月16日 星期六 02时46分22秒 CST 创建的签名,使用 RSA,钥匙号 39499BDB
gpg: 无法检查签名:没有公钥
GPG signature verification failed for '/home/dong/.rvm/archives/rvm-1.29.12.tgz' - 'https://github.com/rvm/rvm/releases/download/1.29.12/1.29.12.tar.gz.asc'! Try to install GPG v2 and then fetch the public key:
gpg2 --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
or if it fails:
command curl -sSL https://rvm.io/mpapis.asc | gpg2 --import -
command curl -sSL https://rvm.io/pkuczynski.asc | gpg2 --import -
In case of further problems with validation please refer to https://rvm.io/rvm/security
这个提示错误,并且给出了解决方法:
运行:
命令1:
curl -sSL https://rvm.io/mpapis.asc | gpg2 --import -
命令2:
curl -sSL https://rvm.io/pkuczynski.asc | gpg2 --import -
再运行上一条命令安装rvm:
curl -L https://get.rvm.io | bash -s stable
输出:
* To start using RVM you need to run `source /home/dong/.rvm/scripts/rvm`
安装成功,按照提示运行:
source /home/dong/.rvm/scripts/rvm
测试:
rvm --version
git --version
安装ruby2.2.6(1.9.3太久了,无法安装)
rvm install 2.2.6
会提示输入本机密码
rvm use 2.2.6
git clone -b source git@github.com:qiuhaidong/qiuhaidong.github.com.git octopress
# 或者 git clone git://github.com/imathis/octopress.git octopress
# octopress 2.0 原码
cd octopress
gem install bundler
bundle install
rake install
rake setup_github_pages
这里可能会要输入链接等,ssh,https
The rake task will ask you for a URL of the Github repo. Copy the SSH or HTTPS URL from your newly created repository
(e.g. git@github.com:username/username.github.io.git)
git@github.com:qiuhaidong/qiuhaidong.github.com.git
https://github.com/qiuhaidong/qiuhaidong.github.com.git
or
git@github.com:haydnyau/haydnyau.github.io.git
https://github.com/haydnyau/haydnyau.github.io.git
and paste it in as a response.
This will:
Next run:
rake generate
rake deploy
This will generate your blog, copy the generated files into _deploy/
, add them to git, commit and push them up to the master branch. In a few seconds you should get an email from Github telling you that your commit has been received and will be published on your site.
来自官网
下面这个不知道要不要做:
Now you have a place to commit the generated content for your site, but you should also set up repository to store the source for your blog. After you set up a repository for your blog source, add it as the origin remote.
git remote add origin (your repo url)
# set your new origin as the default branch
git config branch.master.remote origin
Now push your changes and you’ll be all set.
上面这个不知道要不要做:
来自官网
Don’t forget to commit the source for your blog.
git add .
git commit -m 'update'
git push origin source
category_list
插件在 octopress\plugins\
文件夹里面,新建一个文件,名为:category_list_tag.rb
。并将下面的代码粘贴到里面。
module Jekyll
class CategoryListTag < Liquid::Tag
def render(context)
html = ""
categories = context.registers[:site].categories.keys
categories.sort.each do |category|
posts_in_category = context.registers[:site].categories[category].size
category_dir = context.registers[:site].config['category_dir']
category_url = File.join(category_dir, category.gsub(/_|\P{Word}/, '-').gsub(/-{2,}/, '-').downcase)
html << "<li class='category'><a href='/#{category_url}/'>#{category} (#{posts_in_category})</a></li>\n"
end
html
end
end
end
Liquid::Template.register_tag('category_list', Jekyll::CategoryListTag)
这个插件会向liquid
注册一个名为category_list
的tag
,该tag
就是以li
的形式将站点所有的category
组织起来。如果要将category
加入到侧边导航栏,需要增加一个aside
。
aside
在 octopress\source\_includes\asides\
文件夹里面,新建一个文件,名为:category_list.html
。并粘贴下面的代码:
注意: 去掉 %
前面的2个 \
这里如果不加上\
,markdown格式会显示category_list
的内容。我是为了正确显示代码才加上的
<section>
<h1>Categories</h1>
<ul id="categories">
{\% category_list \%}
</ul>
</section>
代码如下:
dong@Ubuntu:~/octopress$ git push origin source
ERROR: Repository not found.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
打开文件~/octopress/.git/config,查看
[remote "origin"]
url = git@github.com:haydnyau/haydnyau.github.io.git
我是改了几次,com.git和io.git搞错了
preview.sh代码
#!/bin/sh
cd /home/dong/haydnyau
jekyll build #生成
jekyll serve
=================================
deploy.sh代码
#!/bin/sh
cd /home/dong/haydnyau
jekyll build
octopress deploy
=================================
(不行,这个会造成有些blog页面头尾显示不全)发布,并上传/_posts/源文件,deploy.sh 代码
#!/bin/sh
cd /home/dong/haydnyau
jekyll build
mv _posts/ _site/
octopress deploy
mv _site/_posts/ .
注意这个点 “.”
.
或者 ./
表示当前目录
更改了/home/dong/haydnyau/_templates/post 增加了:
categories:
categories: {{ categories }}
因为格式问题没有显示,参见原文件