转载

前端 CentOS 新服配置参考

我自己搭服务器的偏好是 CentOS,每次开新服都要执行一遍的环境配置备忘在此。包含的组件有: git , nginx , nodejs , fishshell

安利下,DigitalOcean 创建新服务器太方便,以至于随便有个想法都上去开个新 Droplet 先,所以才会时不时地开新服。这里是我的 推荐链接 ,注册即得10美元(推荐双方都有)。

CentOS 新服务器

首先安装 epel-release,各种软件包都依赖于这个软件源

$ yum update -y $ yum install -y epel-release $ yum install -y git

一点安全措施

  • 启用 SSH 密钥登陆。编辑 ~/.ssh/authorized_keys ,添加自己的公钥进去。

  • 禁用密码登陆。编辑 /etc/ssh/sshd_config ,启用以下几行:

PubkeyAuthentication            yes AuthorizedKeyFile               .ssh/authorized_keys PasswordAuthentication          no ChallengeResponseAuthentication no

然后重启 sshd 服务:

$ service sshd reload

https://www.liberiangeek.net/2014/07/enable-ssh-key-logon-disable-password-password-less-logon-centos/

http://serverfault.com/questions/285800/how-to-disable-ssh-login-with-password-for-some-users

http://askubuntu.com/questions/387892/how-to-deny-root-ssh-login-require-ssh-key-for-user

nginx 启动!

$ yum install nginx -y

http://www.rackspace.com/knowledge_center/article/centos-adding-an-nginx-init-script

Node 和它的朋友们

$ yum install nodejs -y $ curl https://www.npmjs.com/install.sh | sh $ npm install -g n pm2

最后,需要在 ghost 的 nginx 配置中添加一行 client_max_body_size 10G; 像这样:

server {     listen       80;     server_name  ~b(log)*.amio.us$;      client_max_body_size 256M;          # ... }

Oh-my-fish!

下面是一些个人喜好,装个 fish shell。

$ yum install yum-utils $ yum-config-manager --add-repo http://fishshell.com/files/linux/RedHat_RHEL-6/fish.release:2.repo # CentOS 7 用这个地址: # http://download.opensuse.org/repositories/shells:fish:release:2/CentOS_7/shells:fish:release:2.repo $ yum install fish -y  # 把默认 shell 改为 fish $ chsh -s /usr/bin/fish  

如果 fish 报告错误:

fish: Tried to print invalid wide character string

则编辑此文件:

$ vim /etc/sysconfig/i18n # 把其中的 LANG=C 改为 LANG=en_GB.UTF-8

http://serverfault.com/questions/275403/how-do-i-change-my-locale-to-utf-8-in-centos

正文到此结束
Loading...