- 安装jdk
rpm -ivh jdk-8u11-linux-x64.rpm
java -version
2.安装 mysql
rpm -Uvh mysql56-community-release-el7-11.noarch.rpm
yum install mysql-community-server
service mysqld start
grep ‘temporary password’ /var/log/mysqld.log //初始密码
mysql -uroot -p
set global validate_password_policy=0; //关闭密码复杂性策略
set global validate_password_length=1; //设置密码最低长度为1
ALTER USER ‘root’@’localhost’ IDENTIFIED BY ‘新密码’;
use mysql;
//新建账号并授权
grant SELECT,UPDATE,INSERT,DELETE on *.* to ‘新账号’ @’%’ identified by ‘新密码’;
flush privileges;// 生效配置
//取消only_full_group_by 模式
在my.cnf 中加上
sql_mode = "STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
//但是最好不要关闭
有一个any_value(field)函数允许非分组字段出现
mysql -u用户名 -p3306 -hIP -p
3.redis 安装
tar -zxvf redis-4.0.9.tar.gz
vi redis-4.0.9/redis.conf
Daemoniza yes //后台进程
Bind 127.0.0.1 //绑定本地 远程连接注释掉
Protected mode -no //保护模式关闭
cd redis-4.0.9
make //安装
src/redis-server redis.conf //启动redis
4.tomcat安装
tar -zxvf apache-tomcat-8.0.48.tar.gz
./apache-tomcat-8.0.48/bin/startup.sh
在bin/catalina.sh中可以调优
//远程debug
CATALINA_OPTS=”-Xdebug-Xrunjdwp:transport=dt_socket,address=8888,service=y,suspend=n”
5.定时备份
//数据库备份
mysqldump -uroot -p密码 o2o > /root/backup/sql/o2o`date +%Y%m%d%H%M%S`.sql
//图片备份
tar -zcvf /root/backup/image/image`date+%Y%m%d%H%M%S`.tar.gz
/Users/baidu/work/image/upload/
在一个sh文件中写
crontab -l //查看有没有定时任务
crontab -e //定期执行
6.linux(centos相关)
timedatectl set-time 2017.. //设置时间
Timedatectl set-time 23:59:54
adduser 用户 //添加用户.
passwd 用户//密码
systemctl stop firewalld.service //关闭防火墙
systemctl disable firewalld.service
yum install iptables-services //安装iptables服务
//将对80端口请求转给了8080
iptables -t -nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080
service iptables save //保存
systemctl restart iptables.service //重启服务
systemctl enable iptables.service
ps -ef |grep .. 查找..进程
netstat -anp |grep 端口