配置Yum源

发布 : 2016-01-20 分类 : 大数据 浏览 :

安装Tengine:

1
[root@matrix software]# tar -zxf tengine-2.1.0.tar.gz -C /opt/modules

1
2
[root@matrix software]# cd /opt/modules
[root@matrix modules]# cd tengine-2.1.0

1
[root@matrix tengine-2.1.0]# yum install -y gcc openssl-devel pcre-devel zlib-devel

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
[root@matrix ~]# cd /opt/modules/tengine-2.1.0
[root@matrix tengine-2.1.0]# ./configure \
--prefix=/opt/modules/tengine-2.1.0/ \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--pid-path=/var/run/nginx/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--with-http_ssl_module \
--with-http_flv_module \
--with-http_stub_status_module \
--with-http_gzip_static_module \
--http-client-body-temp-path=/var/tmp/nginx/client/ \
--http-proxy-temp-path=/var/tmp/nginx/proxy/ \
--http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ \
--http-uwsgi-temp-path=/var/tmp/nginx/uwsgi \
--http-scgi-temp-path=/var/tmp/nginx/scgi \
--with-pcre

1
[root@matrix tengine-2.1.0]# make && make install

4.添加服务

4.1.在/etc/init.d下面创建nginx

1
2
3
进入/etc/init.d目录
[root@matrix tengine-2.1.0]# cd /etc/init.d
[root@matrix init.d]# vi nginx

4.2.修改nginx文件内容的路径,从window拷贝到linux

1
2
复制文本的注意事项:
在Linux主机中输入vi nginx 再输入i才进行复制,这样在复制的时候就不会有代码丢失

4.3.修改nginx文件权限755

1
[root@matrix init.d]# chmod 755 nginx

4.3.1.启动nginx,出现如下错误,原因:没有创建该目录

4.4.创建目录

1
2
[root@matrix tengine-2.1.0]# cd /var/tmp/
[root@matrix tmp]# mkdir -p /var/tmp/nginx/

4.5.关闭防火墙

1
[root@matrix sbin]# service iptables stop

4.6.启动tengine,并查看nginx服务状态

1
2
3
4
5
6
7
8
9
[root@matrix modules]# cd tengine-2.1.0
[root@matrix tengine-2.1.0]# cd sbin
[root@matrix sbin]# ll
total 6224
-rwxr-xr-x 1 root root 18983 Feb 29 03:20 dso_tool
-rwxr-xr-x 1 root root 6348971 Feb 29 03:20 nginx
[root@matrix sbin]# ./nginx
[root@matrix sbin]# service nginx status
nginx (pid 14254 14253) is running...

4.6.1.安装成功

1
在浏览器地址栏输入:http://192.168.230.128/

1
挂载光盘:
1
2
3
[root@matrix sbin]# mount /dev/cdrom /mnt
mount: block device /dev/sr0 is write-protected, mounting read-only
[root@matrix sbin]# cd /mnt/

1
2
配置nginx为本地/mnt:
[root@matrix conf]# vi nginx.conf

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
server {
listen 80;
server_name localhost;

#charset koi8-r;

#access_log logs/host.access.log main;

location / {
root /mnt;
autoindex on;
#index index.html index.htm;
}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}

1
2
[root@matrix conf]# service nginx restart
[root@matrix conf]# netstat -ntpl

修改yum源:

1
2
[root@matrix mnt]# cd /etc/yum.repos.d/
[root@matrix yum.repos.d]# vi CentOS-Base.repo

修改baseurl即可:

1
2
3
4
name=CentOS
failovermethod=priority
baseurl=http://matrix
gpgcheck=1

清除yum缓存

1
2
[root@matrix yum.repos.d]# yum clean all
[root@matrix yum.repos.d]# yum makecache

4.7.2.查找nginx进程

1
[root@matrix conf]# ps -aux | grep 'nginx'

4.7.3.添加nginx文件到系统服务中去

1
[root@node1 init.d]# chkconfig --add nginx

4.7.4.查看是否添加成功

1
[root@node1 init.d]# chkconfig --list nginx

1
2
[root@matrix conf]# chkconfig nginx on
[root@matrix conf]# service nginx restart

本文作者 : Matrix
原文链接 : https://matrixsparse.github.io/2016/01/20/配置本地Yum源/
版权声明 : 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明出处!

知识 & 情怀 | 二者兼得

微信扫一扫, 向我投食

微信扫一扫, 向我投食

支付宝扫一扫, 向我投食

支付宝扫一扫, 向我投食

留下足迹