1. 程式人生 > >伺服器部署全程記錄(centos6.5) 170217、nginx 安裝時候報錯:make: *** No rule to make target `build', needed by `default'. Stop. centos7 cannot find a valid base

伺服器部署全程記錄(centos6.5) 170217、nginx 安裝時候報錯:make: *** No rule to make target `build', needed by `default'. Stop. centos7 cannot find a valid base

1.安裝nginx

上傳安裝包:put E:\yz_index\installPackage\nginx-1.14.0.tar.gz

解壓:tar zxvf nginx-1.14.0.tar.gz

切換:cd nginx-1.14.0

準備編譯:./configure

編譯:make

安裝:make install

報錯如下:

[[email protected] nginx-1.14.0]# make
make: *** No rule to make target `build', needed by `default'.  Stop.
[[email protected]
nginx
-1.14.0]# make install make: *** No rule to make target `install'. Stop.

參考:https://www.cnblogs.com/zrbfree/p/6419043.html,是因為少環境

1.1.1 安裝gcc

檢視:rpm -qa gcc

安裝: yum install gcc

1.1.2 安裝PCRE庫

檢視: rpm -qa pcre

安裝:yum install pcre pcre-devel

1.1.3 安裝zlib

檢視: rpm -qa zlib

安裝:yum install zlib zlib-devel

 1.1.4 安裝OpenSSL

檢視: rpm -qa openssl

安裝:yum install openssl openssl-devel

我電腦少這個,所以執行這個安裝命令

報錯如下:

Error Downloading Packages:
  openssl-1.0.1e-57.el6.x86_64: failure: Packages/openssl-1.0.1e-57.el6.x86_64.rpm from base
: [Errno 256] No more mirrors to try. openssl-devel-1.0.1e-57.el6.x86_64: failure: Packages/openssl-devel-1.0.1e-57.el6.x86_64.rpm from base: [Errno 256] No more mirrors to try.

參考:https://blog.csdn.net/wang_zhenwei/article/details/50536180

1.1.4.1 執行:yum clean all

1.1.4.2 執行:yum makecache,報錯如下

[[email protected] nginx-1.14.0]# yum makecache
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os error was
14: PYCURL ERROR 6 - "Couldn't resolve host 'mirrorlist.centos.org'"
Error: Cannot find a valid baseurl for repo: base
View Code

參考:https://www.cnblogs.com/phpandmysql/p/7773063.html

1.1.4.3 vi /etc/sysconfig/network-scripts/ifcfg-eth0, 末尾加入

DNS1=8.8.8.8 #常用
DNS2=4.2.2.2
DNS1=223.5.5.5 #阿里
DNS2=223.6.6.6

1.1.4.4 重啟網路:ifup eth0

結果:這幾臺伺服器連線不了外網,可能不是上面的原因,待續

後續:虛擬機器開通了外網

1.1.4.5 測試: ping www.baidu.com ok

1.1.4.6 再次執行:yum makecache,報錯如下

file:///cdrom/repodata/repomd.xml: [Errno 14] Could not open/read file:///cdrom/repodata/repomd.xml
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: c6-media. Please verify its path and try again
View Code

參考:https://www.cnblogs.com/zgaspnet/p/5258732.html

檢視檔案:cat /etc/yum.repos.d/CentOS-Media.repo

將 baseurl修改為:http://centos.ustc.edu.cn/centos/5/os/i386/

將enabled修改為:0

 1.1.4.7 再次執行:yum makecache. 成功,再次執行上面未完成命令,成功!

測試啟動

cd /usr/local/nginx/sbin/
./nginx

設定開機自啟

vi /etc/init.d/nginx

貼入如下程式碼,注意nginx安裝路徑,如果不是/usr/local則要改為自己的路徑

#!/bin/sh 
# 
# nginx - this script starts and stops the nginx daemon 
# 
# chkconfig:   - 85 15 
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \ 
#               proxy and IMAP/POP3 proxy server 
# processname: nginx 
# config:      /etc/nginx/nginx.conf 
# config:      /etc/sysconfig/nginx 
# pidfile:     /var/run/nginx.pid 

# Source function library. 
. /etc/rc.d/init.d/functions 

# Source networking configuration. 
. /etc/sysconfig/network 

# Check that networking is up. 
[ "$NETWORKING" = "no" ] && exit 0 

nginx="/usr/local/nginx/sbin/nginx" 
prog=$(basename $nginx) 

NGINX_CONF_FILE="/usr/local/nginx/conf/nginx.conf" 

[ -f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginx 

lockfile=/var/lock/subsys/nginx 

start() { 
    [ -x $nginx ] || exit 5 
    [ -f $NGINX_CONF_FILE ] || exit 6 
    echo -n $"Starting $prog: " 
    daemon $nginx -c $NGINX_CONF_FILE 
    retval=$? 
    echo 
    [ $retval -eq 0 ] && touch $lockfile 
    return $retval 
} 

stop() { 
    echo -n $"Stopping $prog: " 
    killproc $prog -QUIT 
    retval=$? 
    echo 
    [ $retval -eq 0 ] && rm -f $lockfile 
    return $retval 
killall -9 nginx 
} 

restart() { 
    configtest || return $? 
    stop 
    sleep 1 
    start 
} 

reload() { 
    configtest || return $? 
    echo -n $"Reloading $prog: " 
    killproc $nginx -HUP 
RETVAL=$? 
    echo 
} 

force_reload() { 
    restart 
} 

configtest() { 
$nginx -t -c $NGINX_CONF_FILE 
} 

rh_status() { 
    status $prog 
} 

rh_status_q() { 
    rh_status >/dev/null 2>&1 
} 

case "$1" in 
    start) 
        rh_status_q && exit 0 
    $1 
        ;; 
    stop) 
        rh_status_q || exit 0 
        $1 
        ;; 
    restart|configtest) 
        $1 
        ;; 
    reload) 
        rh_status_q || exit 7 
        $1 
        ;; 
    force-reload) 
        force_reload 
        ;; 
    status) 
        rh_status 
        ;; 
    condrestart|try-restart) 
        rh_status_q || exit 0 
            ;; 
    *)    
      echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}" 
        exit 2 

esac
View Code
給予許可權:chmod 755 /etc/init.d/nginx
增加為系統服務:chkconfig --add nginx
測試:
[[email protected] ~]# service nginx stop         
/etc/init.d/nginx: line 1: nx: command not found
Stopping nginx:                                            [  OK  ]
[[email protected] ~]# service nginx start
/etc/init.d/nginx: line 1: nx: command not found
Starting nginx:                                            [  OK  ]
View Code

 

 

 安裝oracle

上傳安裝包:

put E:\yz_index\installPackage\p13390677_112040_Linux-x86-64_1of7.zip

put E:\yz_index\installPackage\p13390677_112040_Linux-x86-64_2of7.zip

 

 

 

 

參考

make 和 make install 的區別

170217、nginx 安裝時候報錯:make: *** No rule to make target `build', needed by `default'. Stop.

CentOS學習12_ [Errno 256] No more mirrors to try 解決方法

centos7 cannot find a valid baseurl for repo

解決yum錯誤:Cannot retrieve repository metadata (repomd.xml) for repository