开发者工具
# 安装gcc, g++, make, git, svn
yum clean all
yum groups mark install "Development Tools"
yum groups mark convert "Development Tools"
yum groupinstall "Development Tools"
#选择安装(相关库的头文件)
yum install python-devel libffi-devel zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel libxslt-devel libxml2-devel libjpeg-turbo-devel
EPEL源
sudo yum install epel-release
命令行ncdu, htop
#需要EPEL源
sudo yum install ncdu #磁盘大小查看
sudo yum install htop atop #内存,CPU实用
sudo yum install iotop #磁盘使用IO
sudo yum install iftop #网络
Node.js:
#需要EPEL源
sudo yum install nodejs
Python语言
#安装pip
$ wget https://bootstrap.pypa.io/get-pip.py
$ python ./get-pip.py
#安装pyenv
curl -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash
>然后你需要把以下内容粘贴到[~/.bash_profile]文件中
# pyenv
PYENV_ROOT="$HOME/.pyenv"
PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
#安装pyenv-virtualenvwrapper
git clone https://github.com/yyuu/pyenv-virtualenvwrapper.git ~/.pyenv/plugins/pyenv-virtualenvwrapper
#安装virtualenvwrapper
sudo pip install virtualenvwrapper
>然后你需要把以下内容粘贴到~/.bash_profile文件中
#pyenv virtualenvwrapper
pyenv virtualenvwrapper_lazy
文件传输
# 安装vsftpd
yum install vsftpd
#设置开机启动vsftpd ftp服务
chkconfig vsftpd on
# 创建nologin用户
useradd -d /home/ftp -g ftp -s /sbin/nologin ftpuser -p password
修改以下内容/etc/vsftpd/vsftpd.conf
{
# 禁用匿名登录
anonymous_enable=NO
# 设定支持ASCII模式的上传和下载功能
ascii_upload_enable=YES
ascii_download_enable=YES
只允许刚创建的ftpuser登录FTP
userlist_enable=YES
userlist_deny=NO
}
#修改 /etc/vsftpd/user_list
注释所有帐户,添加ftpuser
#重启服务
service vsftpd restart
#登录
ftp dean@IP地址
nginx服务
//下载nginx到/tmp
curl -o /tmp/nginx.rpm http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
//安装rpm, 此rpm包含yum配置信息
rpm -ivh /tmp/nginx.rpm
//安装nginx
yum install nginx
//2选1, 启动nginx服务, 此时访问公有IP, 就能看到欢迎页面了
systemctl start nginx
service nginx start
//配置文件位置/etc/nginx/nginx.conf
mongoDB数据库
安装
#1.创建/etc/yum.repos.d/mongodb-org-3.0.repo文件内容如下:
[mongodb-org-3.0]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.0/x86_64/
gpgcheck=0
enabled=1
#2.运行
sudo yum install -y mongodb-org
MySQL
安装
sudo yum update
wget http://repo.mysql.com//mysql57-community-release-el7-8.noarch.rpm
sudo rpm -ivh mysql57-community-release-el7-8.noarch.rpm
sudo yum update
sudo yum install mysql-server
启动
sudo systemctl start mysqld
临时密码
sudo grep 'temporary password' /var/log/mysqld.log
安全配置
sudo mysql_secure_installation
用户与表权限
create database testdb;
create user 'testuser'@'localhost' identified by 'password';
grant all on testdb.* to 'testuser' identified by 'password';
重置密码
sudo systemctl stop mysqld
sudo systemctl set-environment MYSQLD_OPTS="--skip-grant-tables"
sudo systemctl start mysqld
mysql -u root
use mysql;
update user SET PASSWORD=PASSWORD("password") WHERE USER='root';
flush privileges;
exit
sudo systemctl stop mysqld
sudo systemctl unset-environment MYSQLD_OPTS
sudo systemctl start mysqld
Scrapyd
#安装
sudo pip install pyOpenSSL
sudo pip install lxml
sudo pip install scrapyd
PM2:
这个用起来感觉要简单一些,而且目前有15,672颗星, 相比第一种拥有资源占用查看,看起来要舒服的多
正常启动Express项目,也就是cd <项目目录>
npm start
或者 node main.js
使用pm2启动cd <项目目录>
pm2 start npm --name='express' -- start
当然也支持其他语言: 例如python
python命令:scrapyd --pidfile /var/log/scrapyd/twistd.pid -l /var/log/scrapyd/logs/scrapyd.log
pm2命令:pm2 start scrapyd --interpreter python --name=scrapyd -- --pidfile "/var/log/scrapyd/twistd.pid" -l "/var/log/scrapyd/logs/scrapyd.log"
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。