HackToday Walk Blog


  • Home

  • Tags

  • Archives

  • Search

How to install grunt on ubuntu 14.04?

Posted on 2015-04-03

今天要调试运行一个程序,需要grunt,发现运行grunt提示:

1
    /usr/bin/env: node: No such file or directory

研究+bing后发现,

grunt 需要依靠npm安装,但是npm需要nodejs版本和ubuntu默认源的版本不匹配,
所以需要按照下面的步骤来安装

1
http://www.tuicool.com/articles/YNJfAjU

简化说来,就是更新确保nodejs的版本合符grunt的要求。

Cannot start container: permission denied

Posted on 2015-02-10

在前一篇我们讨论的kubernetes fedora Ansible环境建立篇中,在fedora 20环境中如果运行

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
cat ~/apache.json
{
"id": "fedoraapache",
"kind": "Pod",
"apiVersion": "v1beta1",
"desiredState": {
"manifest": {
"version": "v1beta1",
"id": "fedoraapache",
"containers": [{
"name": "fedoraapache",
"image": "fedora/apache",
"ports": [{
"containerPort": 80,
"hostPort": 80
}]
}]
}
},
"labels": {
"name": "fedoraapache"
}
}
1
kubectl create -f apache.json

会发现minion的log中包含了Cannot start container: permission denied信息,其实这个是selinux一个相关的bug

https://ask.fedoraproject.org/en/question/50871/cant-run-docker-without-privileged-on-fedora-20/

解决方法:

方法1: 采用其他支持selinux的docker image
方法2:在minion节点setenforce 0,然后重新运行kubectl命令即可

本文采用了方法2,结果如下:

master节点检查

1
2
3
$ kubectl get pod fedoraapache
NAME                IMAGE(S)            HOST                LABELS              STATUS
fedoraapache        fedora/apache       a.b.c.d/        name=fedoraapache   Running

minion节点检查

1
2
$ curl http://localhost
Apache

Kubernetes多节点环境(Fedora Ansible)

Posted on 2015-02-10

昨天参照 https://github.com/GoogleCloudPlatform/kubernetes/blob/master/docs/getting-started-guides/fedora/fedora_ansible_config.md官方的说明老是碰到一个问题:

1
2
$ sudo systemctl start kubelet
Failed to issue method call: Unit docker.socket failed to load: No such file or directory.

Kubernetes社区和Redhat bugzilla说明了是因为package的缘故,旧的依赖是docker.socket,需要更新为新的依赖docker.service (黑体部分)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
$ cat /usr/lib/systemd/system/kubelet.service
[Unit]
Description=Kubernetes Kubelet Server
Documentation=https://github.com/GoogleCloudPlatform/kubernetes
After=docker.service cadvisor.service
Requires=docker.service

[Service]
EnvironmentFile=-/etc/kubernetes/config
EnvironmentFile=-/etc/kubernetes/kubelet
ExecStart=/usr/bin/kubelet \
${KUBE_LOGTOSTDERR} \
${KUBE_LOG_LEVEL} \
${KUBE_ETCD_SERVERS} \
${KUBELET_ADDRESS} \
${KUBELET_PORT} \
${KUBELET_HOSTNAME} \
${KUBE_ALLOW_PRIV} \
${KUBELET_ARGS}
Restart=on-failure

[Install]
WantedBy=multi-user.target

实际上这样修改是无法直接work的,你会发现

1
ansible-playbook -i inventory setup.yml

还是错误,docker.socket的问题,查了半天实在无法理解,那里来的docker.socket

最后不得已,重启机器,发现再次执行没有问题了。好诡异的fedora系统!

Application blocked by Security Settings (Firefox)

Posted on 2015-02-09

最近访问IMM,发现浏览器中启动remote control,老是退出,提示

1
Your security settings have blocked an untrusted application from running

这个问题实际上不是firefox中的security设置问题,而是java的security设置导致。

参见这个帖子

1
https://support.mozilla.org/zh-CN/questions/983382

使用Configure Java,security tab下,将对应的URL加入exception site list中即可。

kubernetes安装-local cluster篇

Posted on 2015-02-05

如果你的操作系统是Ubuntu 14.**,那么文章的下面内容将会对你安装kubernetes提供帮助:
本文的环境搭建针对的是local cluster 方式,
参见 https://github.com/HackToday/kubernetes/blob/master/docs/getting-started-guides/locally.md

  1. 除了上面的一般说明外,有几点需要注意的是

ubuntu安装的docker.io默认是需要root权限使用的,为了系统安装的默认用户使用方面,下面的步骤将帮助你不再每次sudo执行docker命令,[1]

执行下面的命令:

1
2
sudo gpasswd -a ${USER} docker
sudo service docker.io restart

然后:

1
logout and relogin

验证,
docker ps 可以正常执行

  1. 安装etcd

安装etcd比较简单,就是从
https://github.com/coreos/etcd/releases
下载包,然后解压即可

确保对应的etcd在当前用户的$PATH设置里

  1. 安装kubenetes local cluster

这个需要注意一点,如果第1步,没有让用户docker group中,就需要使用sudo命令,但是因为sudo命令的环境变量是使用secure_path会覆盖你写在.bashrc中的设置,所以会出现etcd无法找到的问题,解决方法最好采用1,或者修改secyre_path,其他等等…

  1. 还有一个问题,
    因为kubernetes的etcd检查服务用到了curl命令,ubuntu默认是不安装curl,需要安装curl,避免出现etcd错误的打印服务超时的状态。

参考文献:

  1. http://askubuntu.com/questions/477551/how-can-i-use-docker-without-sudo
  2. http://unix.stackexchange.com/questions/91541/why-is-path-reset-in-a-sudo-command

OpenStack的Instance私钥访问

Posted on 2015-02-04

如果使用openstack的key-pair add后,产生的私钥是pem文件,这个是无法直接通过putty访问的。

需要经过类似的一个key转化的步骤,具体参加这篇blog
http://blog.sina.com.cn/s/blog_575b2c50010198oy.html

然后就可以使用putty访问了, 本文针对的是windows下的用户,如果不用cygwin的方式。

kubernetes安装的问题-Vagrant篇

Posted on 2015-02-03

如果参照安装文档,

1
https://github.com/GoogleCloudPlatform/kubernetes/blob/master/docs/getting-started-guides/vagrant.md

实体物理机安装应该不会有问题,但是奈何资源有限,拿起来我的VirutalBox建了一个虚拟机,Ubuntu 14.04

执行安装脚本,发现了诸多问题

问题1:

1
2
3
4
5
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default: Error: Connection timeout. Retrying...

参见 http://stackoverflow.com/questions/22575261/vagrant-stuck-connection-timeout-retrying 解决方法

问题2:

问题1会引入另外一个问题,就是图形界面的virtualbox会提示你系统不支持硬件加速,无法创建虚拟机。这是因为virtualbox不支持nested virtualization

结合问题1,2,觉得使用single node 安装方法试试。

篇外音,升级virtualbox到4.3.20后,fix了4.3.10开启3D加速系统闪退的问题。

ChefSpec的旧版本问题MatchAliases (NameError)

Posted on 2014-12-23

今天使用bundle exec strainer运行cookbook测试,发现报错,

问题1:

1
uninitialized constant RSpec::Matchers::BuiltIn::RaiseError::MatchAliases (NameError)

查出原来是旧版本的兼容性问题,
http://stackoverflow.com/questions/24459289/rspec-expectations-2-99-0-lib-rspec-matchers-built-in-raise-error-rb5-uninitia

修改Gemfile中的版本依赖如下:
gem ‘chefspec’, ‘~> 4.0’

问题2:

旧的Rspec测试都是基于老的Rspec2,在Rspec 3对应的已经不再支持,所以运行会出现下面的问题,

1
You must pass an argument rather than a block to use the provided matcher (equal true), or the matcher must implement `supports_block_expectations

具体问题参考这个帖子:
http://www.wenda.io/questions/4095574/rspec-3-vs-rspec-2-matchers.html
http://stackoverflow.com/questions/26118031/rspec-3-vs-rspec-2-matchers

具体新的Rspec格式要求参见文档如下:
http://www.rubydoc.info/github/rspec/rspec-expectations/RSpec/Matchers
https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers

问题3:

1
RSpec 3.0 deprecates the :should way of writing specs for expecting things to happen.

也是新的版本的问题,导致旧的语法格式有warnings,
Fix 方法1)
这个帖子介绍的很详细,包含fix方法,
http://makandracards.com/makandra/25409-how-to-remove-rspec-old-syntax-deprecation-warnings

1
2
3
4
5
6
7
8
9
10
11
12
Inside spec/spec_helpber.rb, set rspec-expectations’ and/or rspec-mocks’ syntax as following:


RSpec.configure do |config|
# ...
config.mock_with :rspec do |c|
c.syntax = [:should, :expect]
end
config.expect_with :rspec do |c|
c.syntax = [:should, :expect]
end
end

官方说明:
https://www.relishapp.com/rspec/rspec-expectations/docs/syntax-configuration

Fix 方法2)
还有一种fix方式是修改,转换旧的格式语法,有一个资料介绍一个自动转换工具:
http://yujinakayama.me/transpec/
暂时没有使用上面的方法,有空的话,可以尝试一下。

Redhat 6.5 升级 Redhat 7的经历-也是醉了

Posted on 2014-12-17
  1. https://access.redhat.com/solutions/21964
    Redhat 4,5,6之间的upgrade,官方不给与支持,推荐使用fresh install,然后把对应软件的配置和数据迁移到新的server上

  2. Start from Redhat 7,
    Redhat 对一些特定的case给与了支持,但是支持的力度有限 https://access.redhat.com/node/637583/

  3. 在Redhat Summit上
    http://rhsummit.files.wordpress.com/2014/04/cantrell_w_1650_migrating_and_upgrading_rhel.pdf

    Redhat官方的升级资料有个可恶的问题就是,给出的升级包没有下载的连接,不知道是不是需要什么subscription number 才能看到?
    所以就索性按照Damian Zaremba写的关于 centos 6.5升级到7的步骤执行: http://damianzaremba.co.uk/

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
1. yum update 

2. yum localinstall preupgrade-assistant-1.0.2-36.0.1.el6.centos.x86_64.rpm

3. yum localinstall preupgrade-assistant-contents-0.5.14-1.el6.centos.noarch.rpm

4. yum localinstall redhat-upgrade-tool-0.7.22-3.el6.centos.noarch.rpm

5.
[root@testnode-***** ~]# redhat-upgrade-tool --iso=RHEL-7.0-20140507.0-Server-x86_64-dvd1.iso --force
setting up repos...
getting boot images...
vmlinuz-redhat-upgrade-tool | 4.7MB 00:00 ...
initramfs-redhat-upgrade-tool.img | 32MB 00:00 ...
setting up update...
upgradeiso/filelists_db | 3.0 MB 00:00 ...
finding updates 100% [===========================================================================================]
testing upgrade transaction
rpm transaction 100% [===========================================================================================]
rpm install 100% [===============================================================================================]
setting up system for upgrade
Finished. Reboot to start upgrade.

6. Reboot

悲剧的是重启后,发现系统根本起不来,不能load image.
因为原来系统做过快照,所以恢复一次,重试还是出现同样的问题,以亲身经历验证这个依靠centos的包升级不靠谱。
除非Redhat官方大发慈悲,公布相应的下载包,要不我也是对其升级方案持有悲观态度。

Redhat7 网卡的新命令规则

Posted on 2014-12-13

如果你最近使用Redhat7的话,会发现Redhat 7安装后的网卡名称非常怪异,不要惊慌,其实,这是Redhat公司开发的操作系统新版本的特性,
同事搜到的这篇文章介绍的很详细,至少没在Redhat官方网站上看到这么详细的介绍,值得看一下:

参考文章:

http://www.ehowstuff.com/new-naming-scheme-for-the-network-interface-on-rhel-7centos-7/

1…91011…26

Kai Qiang Wu

This is a place for thinking and writing

253 posts
32 tags
GitHub
© 2020 Kai Qiang Wu
Powered by Hexo
|
Theme — NexT.Gemini v5.1.4
Visitor Total Visit