1、准备
SecureCRT工具安装到本地
http://www.jb51.net/softjc/55...
https://jingyan.baidu.com/art...html
rm -rf + 目录/文件名 : 完全删除文件夹
2、JDK 和 Tomcat
一、jdk环境配置java
我安装在虚拟机的CentOS上,jdk压缩包放在了/bin/root/ 里面 tar –xvf xxx.tar.gz –C /usr/local/java 解压在了/usr/local/java/ 里头 vim /etc/profile 按一下I键,末尾添加 **unset i unset -f pathmunge #set java environment JAVA_HOME=/usr/local/java/jdk1.7.0_80 CLASSPATH=.:$JAVA_HOME/lib.tools.jar PATH=$JAVA_HOME/bin:$PATH export JAVA_HOME CLASSPATH PATH** 按一下ESC键,:wq 退出编辑 从新加载配置文件: source /etc/profile
二、MySQLnode
查看有没有自带mysql rpm -qa | grep -i mysql 卸载 rpm -e --nodeps mysql-xxx 建立文件夹 cd /usr/local mkdir mysql 用远程文件上传的软件链接CentOS的ip,这里使用的软件为FileZilla 上传到root下面的文件是在cd ~ 目录下,能够进入该目录,ll 检测 解压 tar -xvf MySQL-5.6.25-1.el6.x86_64.rpm-bundle.tar -C /usr/local/mysql 进入目录 cd /usr/local/mysql 安装 rpm -ivh xxx
警告
warning: mysql-community-common-5.7.21-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-common-5.7.21-1.e################################# [100%]
解决:rpm --import /etc/pki/rpm-gpg/RPM*
rpm -ivh MySQL-server-5.6.27-1.el6.x86_64.rpm –nosignaturemysql
安装成功截图linux
启动mysql的服务 service mysql start
安装最新版5.7时启动出现错误nginx
未解决c++
进入 /root/.mysql_secret查看密码,复制一下用来首次登陆 cd /root ls -a vim .mysql_secret 登陆 msyql –u root –p [root@localhost ~]# mysql -u root -p
bash: mysql: command not found...sql
输入密码登陆后修改密码 set password = password('123456'); exit 加入到系统服务: chkconfig --add mysql 自动启动: chkconfig mysql on 登陆MySQL,开启远程服务 grant all privileges on *.* to 'root' @'%' identified by '123456'; flush privileges; CentOS7开放3306端口访问(注意7和6防火墙不同)
其余:systemctl stop firewalld.service #中止firewall数据库
systemctl disable firewalld.service #禁止firewall开机启动
三、Tomactapache
用远程文件上传的软件链接CentOS上传文件,这里使用的软件为FileZilla,上传到root下面的文件是在cd ~ 下 建立文件夹 cd /usr/local mkdir tomcat 解压 tar –xvf xxx.tar.gz –C /usr/local/tomcat 放开8080端口 vim /etc/sysconfig/iptables 按O加入: -A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT 按ESC,:wq! 保存后 重启防火墙 systemctl restart iptables.service 开机启动防火墙 systemctl enable iptables.service 进入tomcat安装目录启动服务器sh ./startup.sh 关闭 sh ./shutdown.sh cd /usr/local/tomcat/ ll drwxr-xr-x. 9 root root 4096 2月 8 16:33 apache-tomcat-7.0.84 cd apache-tomcat-7.0.84 cd bin sh ./startup.sh
四、MySQL数据库还原到linux
上传sql文件到到/boot/下, 经过远程链接建立数据库market create database market; 在linux下登陆MySQL还原数据库 use market; source /boot/market.sql
五、个人mysql5.6 的my.cnf配置?
[root@VM_0_4_centos mysql]# find / -name my-default.cnf
/usr/share/doc/MySQL-server-5.6.25/my-default.cnf
/usr/share/mysql/my-default.cnf
[root@VM_0_4_centos mysql]# cd /usr/share/mysql
[root@VM_0_4_centos mysql]# cp my-default.cnf /etc/my.cnf
vim /etc/my.cnf
登陆mysql
service mysql restart mysql -uroot -p123456 show databases;
quit
查看系统中是否有rpm方式安装的mysql
rpm -qa | grep -i mysql
卸载mysql,以安装mysql的逆序进行卸载
清空与mysql相关的全部目录及文件,可使用命令find / -name mysql 进行查找
rm -rf /usr/share/mysql
rm -rf /usr/my.cnf
六、Nginx安装
(1)依赖
yum -y install gcc gcc-c++ autoconf automake make
yum -y install zlib zlib-devel openssl openssl-devel pcre pcre-devel
(2)解压安装包到 /usr/local/ngnix
(3)进入到解压目录下 安装
cd /usr/local/nginx
cd nginx-1.12.2/
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
make && make install
(4)启动
cd /usr/local/nginx/sbin
./nginx
远程访问服务器ip便可看到,前提是防火墙开饭了80端口
(5)查看进程
[root@VM_0_4_centos conf]# ps -ef | grep nginx
root 17620 1 0 22:41 ? 00:00:00 nginx: master process .//nginx
nobody 17621 17620 0 22:41 ? 00:00:00 nginx: worker process
root 18265 14765 0 22:56 pts/0 00:00:00 grep --color=auto nginx
(6)配置文件位置
在安装路径下的conf下的nginx.conf
(7)从新加载配置文件
cd /usr/local/nginx/sbin
./nginx –s reload
(8)查看进程
ps -ef | grep nginx 杀进程 kill -9 进程号
(9)配置服务
在系统服务目录里建立nginx.service文件
cd /lib/systemd/system
touch nginx.service
vi /lib/systemd/system/nginx.service
添加内容以下
[Unit]
Description=nginx
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/usr/local/nginx/sbin/nginx -s quit
PrivateTmp=true
[Install]
WantedBy=multi-user.target
让systemd加载
systemctl daemon-reload
服务命令
1设置开机启动
systemctl enable nginx.service
2其余命令
启动nginx服务
systemctl start nginx.service
设置开机自启动
systemctl enable nginx.service
中止开机自启动
systemctl disable nginx.service
查看服务当前状态
systemctl status nginx.service
从新启动服务
systemctl restart nginx.service
查看全部已启动的服务
systemctl list-units --type=service
七、CentOS7防火墙
CentOS7使用firewalld打开关闭防火墙与端口
一、firewalld的基本使用
启动: systemctl start firewalld
查看状态: systemctl status firewalld
禁用: systemctl disable firewalld
禁用: systemctl stop firewalld
2.systemctl是CentOS7的服务管理工具中主要的工具,它融合以前service和chkconfig的功能于一体。
启动一个服务:systemctl start firewalld.service
关闭一个服务:systemctl stop firewalld.service
重启一个服务:systemctl restart firewalld.service
显示一个服务的状态:systemctl status firewalld.service
在开机时启用一个服务:systemctl enable firewalld.service
在开机时禁用一个服务:systemctl disable firewalld.service
查看服务是否开机启动:systemctl is-enabled firewalld.service
查看已启动的服务列表:systemctl list-unit-files|grep enabled
查看启动失败的服务列表:systemctl --failed
3.配置firewalld-cmd
查看版本: firewall-cmd --version
查看帮助: firewall-cmd --help
显示状态: firewall-cmd --state
查看全部打开的端口: firewall-cmd --zone=public --list-ports
更新防火墙规则: firewall-cmd --reload
查看区域信息: firewall-cmd --get-active-zones
查看指定接口所属区域: firewall-cmd --get-zone-of-interface=eth0
拒绝全部包:firewall-cmd --panic-on
取消拒绝状态: firewall-cmd --panic-off
查看是否拒绝: firewall-cmd --query-panic
那怎么开启一个端口呢添加firewall-cmd --zone=public --add-port=80/tcp --permanent (--permanent永久生效,没有此参数重启后失效)从新载入firewall-cmd --reload查看firewall-cmd --zone=public --query-port=80/tcp删除firewall-cmd --zone=public --remove-port=1501/tcp --permanent