Chef Server安装问题

Mad*_*adz 7 chef-infra

我一直在尝试使用本指南在我的CentOS 6.5机器上安装厨师服务器(chef-server-core-12.1.0-1.el6.x86_64.rpm):http://docs.chef.io/server/install_server .html #standalone 这是一个测试环境,因此我没有FQDN,但IP地址是可解析的.运行chef-server-ctl reconfigure之后,我尝试使用以下命令创建用户:

[root@xxx-xxx-xxx-xxx ~]# chef-server-ctl user-create myusername myfirstname mylastname myemail mypassword --filename /root/myfile.pem
Run Code Online (Sandbox Code Playgroud)

我在上面的命令中填写了相应的详细信息,但我一直收到此错误:

ERROR: Connection refused connecting to https://127.0.0.1/users/, retry 5/5
ERROR: Network Error: Connection refused - Connection refused connecting to        https://127.0.0.1/users/, giving up
Check your knife configuration and network settings
Run Code Online (Sandbox Code Playgroud)

ngnix服务一直处于停机状态,无法启动.通过日志后:

 tail -f /var/log/opscode/nginx/current 
 2015-07-01_10:59:00.69218 nginx: [emerg] invalid number of arguments in "server_name" directive in /var/opt/opscode/nginx/etc/chef_https_lb.conf:3
Run Code Online (Sandbox Code Playgroud)

文件chef_https_lb.conf如下:

server {
listen 443;
server_name ;

access_log /var/log/opscode/nginx/access.log opscode;
Run Code Online (Sandbox Code Playgroud)

我不确定什么是错的.有人点亮了吗?

Joh*_*ohn 7

如果有人偶然发现这个寻找答案(正如我所做的那样).问题是您需要设置除localhost之外的服务器的FQDN.

Centos 6.6上的示例

在/ etc/hosts文件中,读取(或类似)的顶行

127.0.0.1 localhost
Run Code Online (Sandbox Code Playgroud)

将localhost更改为您为服务器设置的主机名(/etc/sysconfig/network)

127.0.0.1 servername.com
Run Code Online (Sandbox Code Playgroud)

重新启动网络服务

$: service network restart
Run Code Online (Sandbox Code Playgroud)

在服务器终端上运行以下命令时

$: hostname
$: hostname -f
Run Code Online (Sandbox Code Playgroud)

他们都应输出"servername.com"

运行chef-server-ctl reconfigure以重建Chef服务器的ssl证书.

您应该能够添加管理员用户/ ORG和opscode-manage Web界面


小智 6

就我而言,是 nginx 未能绑定到端口 80,因为 apache2 已经在使用它。所以我的Chef-server-ctl tail nginx看起来像这样

# chef-server-ctl tail nginx                                                                                                                                                  
==> /var/log/opscode/nginx/internal-chef.access.log <==

==> /var/log/opscode/nginx/error.log <==
2016/07/20 12:22:29 [emerg] 28912#0: listen() to 0.0.0.0:80, backlog 511 failed (98: Address already in use)
2016/07/20 12:22:29 [emerg] 28912#0: listen() to 0.0.0.0:80, backlog 511 failed (98: Address already in use)
2016/07/20 12:22:29 [emerg] 28912#0: listen() to 0.0.0.0:80, backlog 511 failed (98: Address already in use)
2016/07/20 12:22:29 [emerg] 28912#0: listen() to 0.0.0.0:80, backlog 511 failed (98: Address already in use)
2016/07/20 12:22:29 [emerg] 28912#0: still could not bind()
Run Code Online (Sandbox Code Playgroud)

所以我查看了nginx.conf文件并注释掉了侦听端口 80 的服务器 - 看到它无论如何都会重定向到 443。然后我重新启动nginx和chef-server-ctl user-create ...工作:)例如

# vi /var/opt/opscode/nginx/etc/nginx.conf
 ...
    # We support three options: serve nothing on non_ssl_port (80),
    # redirect to https, or actually serve the API.
    #     server {
    #       listen 80;
    #       access_log /var/log/opscode/nginx/rewrite-port-80.log;
    #       return 301 https://$host$request_uri;
    #     }

# chef-server-ctl restart nginx
ok: run: nginx: (pid 32236) 0s
# chef-server-ctl user-create username fname sname username@example.com password --filename username.pem
Run Code Online (Sandbox Code Playgroud)