1,安裝nodejs
1,下載安裝文件
https://nodejs.org/zh-cn/download/

2,安裝步驟
1,將安裝包上傳到云服務(wù)器,并解壓
我習(xí)慣上傳到/root/program文件夾,program需要新建
tar -xvf node-v10.6.0-linux-x64.tar.xz
2,重命名文件夾為nodejs
mv node-v10.6.0-linux-x64 nodejs
3,將nodejs變?yōu)槿?/h3>
ln -s /root/program/nodejs/bin/npm /usr/local/bin/
ln -s /root/program/nodejs/bin/node /usr/local/bin/
3,檢查是否創(chuàng)建成功
node -v
v10.6.0
參考網(wǎng)站
ln -s /root/program/nodejs/bin/npm /usr/local/bin/
ln -s /root/program/nodejs/bin/node /usr/local/bin/
node -v
v10.6.0
https://www.cnblogs.com/mao2080/p/9346018.html、
1,安裝 Redis
1,安裝依賴(lài)
yum install -y wget gcc make tcl
2,安裝官網(wǎng)步驟下載并運(yùn)行
$ wget http://download.redis.io/releases/redis-5.0.5.tar.gz
$ tar xzf redis-5.0.5.tar.gz
$ cd redis-5.0.5
$ make
運(yùn)行
src/redis-server
也可以這樣使用內(nèi)置客戶端與redis聯(lián)通
$ src/redis-cli
redis> set foo bar
OK
redis> get foo
"bar"
測(cè)試redis-cli如果報(bào)了下面的錯(cuò)誤
Could not connect to Redis at 127.0.0.1:6379: Connection refused
那么打開(kāi)redis目錄下的redis.conf文件
修改daemonize no 為 daemonize yes
再在src目錄下輸入
./redis-server /root/program/redis-5.0.5/redis.conf
這樣就可以了
3,安裝mongodb
下載程序
從官網(wǎng)下載壓縮包到云服務(wù)器
wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel70-4.2.0.tgz
解壓壓縮包
tar mongodb-linux-x86_64-rhel70-4.2.0.tgz
修改文件夾名稱(chēng)
從mongodb-linux-x86_64-rhel70-4.2.0改為mongodb
回到操作系統(tǒng)中全局目錄下進(jìn)入etc目錄搜索proflie文件文件在最后一行加入
export PATH=$PATH:/root/program/mongodb/bin
保存并重啟系統(tǒng)
直接打開(kāi)終端在/root/program/mongodb下創(chuàng)建db文件夾,用來(lái)存放數(shù)據(jù)庫(kù)
接著在/root/program/mongodb目錄下新建一個(gè)名為mongodb.conf的配置文件,寫(xiě)入如下配置內(nèi)容
# 普通配置文件
# mongodb.conf
dbpath=/root/program/mongodb/db
logpath=/root/program/mongodb/mongodb.log
#pidfilepath=/var/log/mongodb/master.pid
directoryperdb=true
logappend=true
bind_ip=127.0.0.1
port=27017
fork=true
保存。然后輸入命令啟動(dòng)
mongod --config /root/program/mongodb/mongodb.conf
打開(kāi)mongodb.log文件,看到最后一行”waiting for connections on port 27017”就說(shuō)明啟動(dòng)成功了。
安裝pm2
npm install -g pm2
ln -s /root/program/nodejs/bin/pm2 /usr/local/bin/
4,安裝Nginx
參考地址:https://www.runoob.com/linux/nginx-install-setup.html
1,安裝編譯工具及庫(kù)文件
我把目錄集中安裝在/root/program 下比較容易控制
yum -y install make zlib zlib-devel gcc-c++ libtool openssl openssl-devel
2,安裝 PCRE,讓 Nginx 支持 Rewrite 功能
安裝并解壓安裝包,進(jìn)入目標(biāo)文件夾
cd /root/program
wget http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz
tar zxvf pcre-8.35.tar.gz、
cd pcre-8.35
編譯安裝
./configure
make && make install
查看pcre版本
pcre-config --version
3,安裝 Nginx
安裝壓縮包,解壓并進(jìn)入目錄
cd /root/program
wget http://nginx.org/download/nginx-1.6.2.tar.gz
tar zxvf nginx-1.6.2.tar.gz
cd nginx-1.6.2
編譯安裝
[root@bogon nginx-1.6.2]# ./configure --prefix=/usr/local/webserver/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre=/usr/local/src/pcre-8.35
[root@bogon nginx-1.6.2]# make
[root@bogon nginx-1.6.2]# make install
查看nginx版本
/root/program/webserver/nginx/sbin/nginx -v
編輯/root/program/nginx-1.6.2/conf/nginx.conf
注意把server修改為/var/html并把nginx文件夾下的html文件夾轉(zhuǎn)移過(guò)去
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include 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 logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root /var/html;
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;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}
檢查配置文件nginx.conf的正確性命令:
/root/program/webserver/nginx/sbin/nginx -t
啟動(dòng) Nginx
/root/program/webserver/nginx/sbin/nginx