1.没有ifconfig查看本机IP:ip addr查看网卡名称
不能访问外网,部署虚拟机网络设置:(1)若开启NAT模式,并且开启DHCP功能,请用dhclient ens33 启动本机的IP
拼外网是否能通(2)设置static静态IP(推荐),示例如下:vi /etc/sysconfig/network-scripts/ifcfg-eth0
TYPE=Ethernet
PROXY_METHOD=none
#修改为本机的MAC地址
HWADDR=00:0c:29:cb:db:31
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
#设置自己想要的IP
IPADDR=192.168.197.131
NETMASK=255.255.255.0
GATEWAY=192.168.197.2
DNS1=8.8.8.8
DNS2=4.4.4.4
#网卡名,按照ifconfig出来的网卡名
NAME=ens33
#修改为本机的UUID
UUID=9e5935c5-faed-4b43-abb3-12cde7a94591
DEVICE=ens33
BROWSER_ONLY=no
DEFROUTE=yes
(2)使用UE编辑器,ftp浏览服务器时:
invalid username or password reported by server
解决:
服务器报告的用户名或密码无效,请确认输入用户名是否正确
(3)最小安装系统安装ssh
rpm -qa|grep ssh 判断是否存在已安装ssh
如果显示存在
systemctl start sshd
不存在就按照其他方案执行,一般都会安装
2.下载最新安装包.tar.gz,并解压,到响应的解压目录,编译安装Nginx
yum -y install gcc gcc-c++
./configure --prefix=/usr/local/nginx
./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=<path> option.
yum install -y pcre-devel
./configure: error: the HTTP gzip module requires the zlib library.
You can either disable the module by using --without-http_gzip_module
option, or install the zlib library into the system, or build the zlib library
statically from the source with nginx by using --with-zlib=<path> option.
yum install -y zlib-devel
make[1]: 离开目录“/usr/local/nginx-1.14.0”不用处理
make && make install
/usr/local/nginx/sbin/nginx
/usr/local/nginx/sbin/nginx -s stop
/usr/local/nginx/sbin/nginx -s reload
记得关闭Selinux/Firewalls
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --zone=public --add-port=514/tcp --permanent
firewall-cmd --reload
测试:Nginx首页 http://IP/或http://IP:指定端口
推荐:修改nginx与php-fpm(php fastcgi_param)的连接,在/usr/local/nginx/conf/nginx.conf配置文件:
location ~ \.php$ {
root /usr/local/nginx/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
#fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_scrippt_name;
#fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
正确配置root目录(html改为/usr/local/nginx/html)、IP地址及端口、/scripts改为$document_root
方式(2)yum install GeoIP
rpm -ivh nginx-mod-* --nodeps
rpm -ivh nginx-all-modules-1.12.2-1.el7.noarch.rpm
rpm -ivh nginx-1.12.2-1.el7.x86_64.rpm
nginx
nginx -s quit
vi /etc/nginx/nginx.conf
3.安装tomcat
下载指定版本的tomcat:
https://blog.csdn.net/u010523770/article/details/52456973
DownLoad->Archives->bin->指定版本
下载jdk
http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
downloads-jdk-accept-*.rpm
rpm -ivh /home/jdk-7u67-linux-x64.rpm
输入命令检查是否已经安装设置好
#java
#java -version
#javac
#tar -zxvf apache-tomcat-8.0.9.tar.gz //解压文件
#cp -R apache-tomcat-8.0.9 /usr/local/tomcat //移动和重命名
#./startup.sh //在tomcat的bin目录下执行此命令,显示下面的信息
显示:Tomcat started.
访问http://ip:8080,查看是否成功
--------连接Navicat错误时,设置mysql数据库的参数,set global show_compatibility_56=on;
4.redis安装
参考:https://blog.csdn.net/ul646691993/article/details/52736279
http://download.redis.io/releases/redis-3.0.4.tar.gz下载安装包
新建安装目录,将安装包传至新建目录,解压、编译:mkdir -p /data/dev/software/
安装插件:yum -y install gcc
make
make install
启动
[root@VS-UnionApp-cache1 utils]# ./install_server.sh
Welcome to the redis service installer
This script will help you easily set up a running redis server
Please select the redis port for this instance: [6379]
Selecting default: 6379
Please select the redis config file name [/etc/redis/6379.conf] /data/dev/software/redis_6379/6379.conf
Please select the redis log file name [/var/log/redis_6379.log] /data/dev/software/redis_6379/log/redis_6379.log
Please select the data directory for this instance [/var/lib/redis/6379] /data/dev/software/redis_6379/data
Please select the redis executable path [/usr/local/bin/redis-server]
修改配置文件:
vi /data/dev/software/redis_6379/6379.conf
daemonize yes
pidfile /data/dev/software/redis_6379/redis-pid
port 6379
timeout 0
tcp-keepalive 0
loglevel notice
logfile /data/dev/software/redis_6379/log/redis-server.log
databases 16
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
dir /data/dev/software/redis_6379/data
slave-serve-stale-data yes
slave-read-only yes
repl-disable-tcp-nodelay no
slave-priority 100
#设置密码,修改完成尽量删除注释
requirepass issmart
appendonly no
appendfilename "appendonly.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
notify-keyspace-events ""
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-entries 512
list-max-ziplist-value 64
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
aof-rewrite-incremental-fsync yes
##为了能让Redis在服务器重启后自动启动,需要将启动命令写入开机启动项:
##echo "/usr/local/bin/redis-server /etc/redis.conf" >>/etc/rc.local
/etc/init.d/redis_6379 start
/etc/init.d/redis_6379 stop
5.MongoDB安装
下载地址:https://www.mongodb.com/download-center?jmp=nav#community
参考https://blog.csdn.net/jacson_bai/article/details/42361391
下载安装包后,无需安装,直接解压去bin目录下执行(启动MongoDB服务):
/usr/local/mongodb/bin/mongod --dbpath /mongo/data/ --logpath /mongo/logs/test.log --fork --port 27017
#连接数据库 : /usr/local/mongodb/bin/mongo
新建mongodb.conf配置文件, 通过这个配置文件进行启动.
vim /etc/mongodb.conf
dbpath=/usr/local/mongodb/data/db
logpath=/usr/local/mongodb/logs/mongodb.logs
logappend=true
bind_ip=0.0.0.0
port=27017
fork=true
##auth = true # 先关闭, 创建好用户在启动
mongodb的参数说明:
--dbpath 数据库路径(数据文件)
--logpath 日志文件路径
--master 指定为主机器
--slave 指定为从机器
--source 指定主机器的IP地址
--pologSize 指定日志文件大小不超过64M.因为resync是非常操作量大且耗时,最好通过设置一个足够大的oplogSize来避免resync(默认的 oplog大小是空闲磁盘大小的5%)。
--logappend 日志文件末尾添加
--port 启用端口号
--fork 在后台运行
--only 指定只复制哪一个数据库
--slavedelay 指从复制检测的时间间隔
--auth 是否需要验证权限登录(用户名和密码)
注:mongodb配置文件里面的参数很多,定制特定的需求,请参考官方文档
配置环境变量:修改/etc/profile
, 添加如下内容
vim /etc/profile
export MONGODB_HOME=/usr/local/mongodb
export PATH=$MONGODB_HOME/bin:$PATH
执行命令:
source /etc/profile
启动:
通过配置文件启动
mongod -f /etc/mongodb.conf
about to fork child process, waiting until server is ready for connections.
forked process: 2814
child process started successfully, parent exiting
创建数据库:
use test
switched to db test
创建成功.
创建用户, 设置权限
db.createUser({user: "test",pwd: "test",roles: [ { role: "readWrite", db: "test" } ]})