月度归档:2016年09月

Ubuntu创建用户并给与管理员权限

创建用户

sudo adduser henry

之后填写一些个人信息之后新用户就创建成功了。

接下来给予新用户管理员权限

chmod 755 /etc/sudoers
vim /etc/sudoers

修改文件如下

# User privilege specification
root   ALL=(ALL) ALL
henry  ALL=(ALL) ALL

保存后,新用户henry就有了管理员权限

su henry

恢复文件权限

sudo chmod 440 /etc/sudoers

CentOS安装Nginx

Official Red Hat/CentOS packages

To add NGINX yum repository, create a file named /etc/yum.repos.d/nginx.repo and paste one of the configurations below:

CentOS:

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1

RHEL:

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/rhel/$releasever/$basearch/
gpgcheck=0
enabled=1

Due to differences between how CentOS, RHEL, and Scientific Linux populate the $releasever variable, it is necessary to manually replace $releasever with either 5 (for 5.x) or 6 (for 6.x), depending upon your OS version.

use

yum info nginx

to show the information about Nginx

[root@localhost ~]# yum info nginx
Loaded plugins: fastestmirror
nginx | 2.9 kB 00:00:00 
nginx/7/x86_64/primary_db | 14 kB 00:00:22 
Loading mirror speeds from cached hostfile
 * base: mirrors.linode.com
 * extras: mirrors.linode.com
 * updates: mirrors.linode.com
Available Packages
Name : nginx
Arch : x86_64
Epoch : 1
Version : 1.10.1
Release : 1.el7.ngx
Size : 640 k
Repo : nginx/7/x86_64
Summary : High performance web server
URL : http://nginx.org/
License : 2-clause BSD-like license
Description : nginx [engine x] is an HTTP and reverse proxy server, as well as
 : a mail proxy server.

Then

yum install nginx

参考:https://www.nginx.com/resources/wiki/start/topics/tutorials/install/