分类: LINUX 目的
服务端配置1、安装httpserver服务$ yum install nginx 2、安装createrepo软件包$ yum install createrepo 3、建立存放软件包仓库 目录$ mkdir -p /opt/yoursite/yum/centos/6/os/x86_64 $ createrepo /opt/yoursite/yum/centos/6/os/x86_64/ $ mkdir -p /opt/yoursite/yum/centos/6/updates/x86_64 $ createrepo /opt/yoursite/yum/centos/6/updates/x86_64/ 4、nginx 配置
$ mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bak.20150428
$ useradd -m -U www //创建nginx log文件夹 $ mkdir -p /opt/logs/nginx
$ vim /etc/nginx/nginx.conf user www; worker_processes 4; worker_rlimit_nofile 100000; worker_cpu_affinity 000000000000000000000001 000000000000000000000010 000000000000000000000100 000000000000000000001000; error_log /opt/logs/nginx/error.log warn; pid /var/run/nginx.pid; events { use epoll; worker_connections 65535; } http { include /etc/nginx/mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /opt/logs/nginx/access.log main; server_names_hash_bucket_size 128; client_header_buffer_size 32k; large_client_header_buffers 4 32k; client_max_body_size 100m; sendfile on; keepalive_timeout 65; gzip on; gzip_min_length 1024; gzip_buffers 4 16k; gzip_http_version 1.0; gzip_comp_level 2; gzip_types text/plain application/x-javascript text/css application/xml; gzip_vary on; fastcgi_connect_timeout 300; fastcgi_send_timeout 300; fastcgi_read_timeout 300; fastcgi_buffer_size 64k; fastcgi_buffers 4 64k; fastcgi_busy_buffers_size 128k; fastcgi_temp_file_write_size 128k; fastcgi_intercept_errors on; include /etc/nginx/conf.d/*.conf; }
server { listen 80; charset utf8; server_name yum.yoursite.com; access_log /opt/logs/nginx/yum.yoursite.com.access.log main; root /opt/yoursite/yum; index index.html; }
$ service nginx start //开机启动nginx $ chkconfig nginx on 5、从其他源下载rpm安装包
$ yum -y install yum-utils.noarch
$ yumdownloader nginx-1.4.1-1.el6.x86_64 $ yumdownloader php-5.5.5-2.el6.x86_64.rpm $ 等等其他各种需要的软件包
#查询rpm包的依赖包 $ repoquery --requires --resolve nginx $ yumdownloader 安装依赖包
$ createrepo /opt/yousite/yum/centos/6/os/x86_64/ 客户端配置
1、指定安装源
$ vim mirrors_stevenrao.repo #[serverid] 是用于区别各个不同的repository,必须有一个独一无二的名称;可以随便命名 [stevenrao-base] name=centos-$releasever-stevenrao-base baseurl= enabled=1 gpgcheck=0 #released updates [stevenrao-update] name=centos-$releasever-stevenrao-update baseurl= enabled=1 gpgcheck=0 2、yum.conf
#yum本地缓存的目录,yum在此存储下载的rpm包和数据库 cachedir=/var/cache/yum/$basearch/$releasever #安装完成后是否保留软件包,0为不保留(默认为0),1为保留 keepcache=0 #debuglevel:Debug信息输出等级,范围为0-10,缺省为2 debuglevel=2 #存放系统更新软件的日志的目录 logfile=/var/log/yum.log #有1和0两个选项,设置为1,则yum 只会安装和系统架构匹配的软件包,例如,yum 不会将i686的软件包安装在适合i386的系统中。默认为1。exactarch=1 #相当于upgrade,允许更新陈旧的RPM包 obsoletes=1 #有1和0两个选择,分别代表是否是否进行gpg(GNU Private Guard) 校验,以确定rpm 包的来源是有效和安全的。这个选项如果设置在[main]部分,则对每个repository 都有效。默认值为0。 gpgcheck=0 #是否启用插件,默认1为允许,0表示不允许。我们一般会用插件 plugins=1 installonly_limit=5 bugtracker_url= project_id=16&ref=category=yum distroverpkg=centos-release 3、测试#清除所有本地安装包cache $ yum clean all $ yum install nginx 附录(yum常见命令)
阅读(22969) | 评论(2) | 转发(2) | |
|
来自: 昵称QAb6ICvc > 《电脑知识》