系统:centos6 配置mirror阿里云 https://opsx.alibaba.com/mirrorphp
远程管理首选:ssh 帐户密码登陆(ssh user@host) 或者 本地私钥链接服务器公钥(推荐)html
=>ssh服务自己配置(禁止掉root、只容许密钥):etc/ssh/sshd_config 前端
【SSH初次适用】java
密钥对
2. ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
代理
3. eval "$(ssh-agent -s)"
注册私钥
4. ssh-add ~/.ssh/id_rsa
填充公钥
5. cat id_rsa.pub | clip
6. GitHub > profile > SSH keys 添加就好啦。
7. ssh-copy-id 192.168.10.10mysql
1. 【虚拟机上网初始化】编辑 => 虚拟网络编辑器 => 桥接模式(独立虚拟机) => 选择一张已经联网的网卡。linux
………………………………………………………………【JDK】nginx
【清除自带jdk】c++
rpm -qa | grep jdk git
sudo yum remove 查询结果sql
【权限全开】
sudo chmod 777 安装包
【安装】默认路径 usr/java/
sudo rpm -ivh 安装包
【环境变量】
sudo vim /etc/profile
export JAVA_HOME=/usr/java/路径
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib
export PATH=$JAVA_HOME/bin:$PATH
source /etc/profile
………………………………………………………………【JDK】
………………………………………………………………【Tomcat】
【windows 和 虚拟机共享目录】C:\Users\sunw31\Documents\Virtual Machines\vms
【tar -zvxf 压缩包】z=gz v=verbose x=extract f=force
【环境配置】
export CATALINA_HOME=/developer/apache-tomcat-7.0.73
【CATALINA_BASE 默认系统盘idea.system下】只能修改 idea.properties 的 idea.system 从而改变路径 CATALINA_BASE。
【配置 UTF-8 字符集】
cd $CATALINA_HOME/conf
vim server.xml
找到配置 <Connector port="8080" 增长属性 URIEncoding="UTF-8"
【验证】bin/startup.sh 看一下。
ifconfig 拿 ip 访问下,访问不了看下防火墙。
………………………………………………………………【Tomcat】
………………………………………………………………【Maven】
tar -zvxf
/etc/profile
export MAVEN_HOME=/developer/apache-maven-xxx
【settings.xml】nexus + mirror
【经常使用命令】
mvn clean
mvn compile
mvn package
mvn clean package -Dmaven.test.skip=true
………………………………………………………………【Maven】
………………………………………………………………【vsftpd】
【安装】sudo yum -y install vsftpd
【检查】rpm -qa | grep vsftpd
【配置文件位置】/etc/vsftpd/vsftpd.conf
【建立虚拟用户】意思是说 这个用户有权限上传 下载 rwx...
cd /
mkdir ftpfile
useradd ftpuser -d /ftpfile -s /sbin/nologin
chown -R ftpuser.ftpuser /ftpfile
sudo passwd ftpuser
cd ftpfile下 建立一个 index.html 等下访问看到
【配置加入虚拟用户 分离主配置 】
cd /etc/vsftpd
sudo vim chroot_list 写个内容 "ftpuser"
【关闭selinux】sudo vim /etc/selinux/config
SELINUX=disabled
sudo setenforce 0
【若是 505 错误】sudo setsebool -P ftp_home_dir 1 而后重启机器
【参考配置】
本项目要用到的配置项: 1)local_root=/ftpfile(当本地用户登入时,将被更换到定义的目录下,默认值为各用户的家目录) 2)anon_root=/ftpfile(使用匿名登入时,所登入的目录) 3)use_localtime=YES(默认是GMT时间,改为使用本机系统时间) 4)anonymous_enable=NO(不容许匿名用户登陆) 5)local_enable=YES(容许本地用户登陆) 6)write_enable=YES(本地用户能够在本身家目录中进行读写操做) 7)local_umask=022(本地用户新增档案时的umask值) 8)dirmessage_enable=YES(若是启动这个选项,那么使用者第一次进入一个目录时,会检查该目录下是否有.message这个档案,若是有,则会出现此档案的内容,一般这个档案会放置欢迎话语,或是对该目录的说明。默认值为开启) 9)xferlog_enable=YES(是否启用上传/下载日志记录。若是启用,则上传与下载的信息将被完整纪录在xferlog_file 所定义的档案中。预设为开启。) 10)connect_from_port_20=YES(指定FTP使用20端口进行数据传输,默认值为YES) 11)xferlog_std_format=YES(若是启用,则日志文件将会写成xferlog的标准格式) 12)ftpd_banner=Welcome to mmall FTP Server(这里用来定义欢迎话语的字符串) 13)chroot_local_user=NO(用于指定用户列表文件中的用户是否容许切换到上级目录) 14)chroot_list_enable=YES(设置是否启用chroot_list_file配置项指定的用户列表文件) 15)chroot_list_file=/etc/vsftpd/chroot_list(用于指定用户列表文件) 16)listen=YES(设置vsftpd服务器是否以standalone模式运行,以standalone模式运行是一种较好的方式,此时listen必须设置为YES,此为默认值。建议不要更改,有不少与服务器运行相关的配置命令,须要在此模式下才有效,若设置为NO,则vsftpd不是以独立的服务运行,要受到xinetd服务的管控,功能上会受到限制) 17)pam_service_name=vsftpd(虚拟用户使用PAM认证方式,这里是设置PAM使用的名称,默认便可,与/etc/pam.d/vsftpd对应) userlist_enable=YES(是否启用vsftpd.user_list文件,黑名单,白名单均可以 18)pasv_min_port=61001(被动模式使用端口范围最小值) 19)pasv_max_port=62000(被动模式使用端口范围最大值) 20)pasv_enable=YES(pasv_enable=YES/NO(YES) 若设置为YES,则使用PASV工做模式;若设置为NO,则使用PORT模式。默认值为YES,即便用PASV工做模式。 FTP协议有两种工做方式:PORT方式和PASV方式,中文意思为主动式和被动式。 1、PORT(主动)方式的链接过程是:客户端向服务器的FTP端口(默认是21)发送链接请求,服务器接受链接,创建一条命令链路。 当须要传送数据时,客户端在命令链路上用 PORT命令告诉服务器:“我打开了****端口,你过来链接我”。因而服务器从20端口向客户端的****端口发送链接请求,创建一条数据链路来传送数据。 2、PASV(被动)方式的链接过程是:客户端向服务器的FTP端口(默认是21)发送链接请求,服务器接受链接,创建一条命令链路。 当须要传送数据时,服务器在命令链路上用 PASV命令告诉客户端:“我打开了****端口,你过来链接我”。因而客户端向服务器的****端口发送链接请求,创建一条数据链路来传送数据。 从上面能够看出,两种方式的命令链路链接方法是同样的,而数据链路的创建方法就彻底不一样。而FTP的复杂性就在于此。 )
sudo vim /etc/vsftpd/vsftpd.conf
# Example config file /etc/vsftpd/vsftpd.conf # # The default compiled in settings are fairly paranoid. This sample file # loosens things up a bit, to make the ftp daemon more usable. # Please see vsftpd.conf.5 for all compiled in defaults. # # READ THIS: This example file is NOT an exhaustive list of vsftpd options. # Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's # capabilities. # # Allow anonymous FTP? (Beware - allowed by default if you comment this out). local_root=/product/ftpfile #chroot_local_user=YES anon_root=/product/ftpfile use_localtime=YES #匿名 #anonymous_enable=YES anonymous_enable=NO # # Uncomment this to allow local users to log in. local_enable=YES # # Uncomment this to enable any form of FTP write command. write_enable=YES # # Default umask for local users is 077. You may wish to change this to 022, # if your users expect that (022 is used by most other ftpd's) local_umask=022 # # Uncomment this to allow the anonymous FTP user to upload files. This only # has an effect if the above global write enable is activated. Also, you will # obviously need to create a directory writable by the FTP user. #anon_upload_enable=YES # # Uncomment this if you want the anonymous FTP user to be able to create # new directories. #anon_mkdir_write_enable=YES # # Activate directory messages - messages given to remote users when they # go into a certain directory. dirmessage_enable=YES # # The target log file can be vsftpd_log_file or xferlog_file. # This depends on setting xferlog_std_format parameter xferlog_enable=YES # # Make sure PORT transfer connections originate from port 20 (ftp-data). connect_from_port_20=YES # # If you want, you can arrange for uploaded anonymous files to be owned by # a different user. Note! Using "root" for uploaded files is not # recommended! #chown_uploads=YES #chown_username=whoever # # The name of log file when xferlog_enable=YES and xferlog_std_format=YES # WARNING - changing this filename affects /etc/logrotate.d/vsftpd.log #xferlog_file=/var/log/xferlog # # Switches between logging into vsftpd_log_file and xferlog_file files. # NO writes to vsftpd_log_file, YES to xferlog_file xferlog_std_format=YES # # You may change the default value for timing out an idle session. #idle_session_timeout=600 # # You may change the default value for timing out a data connection. #data_connection_timeout=120 # # It is recommended that you define on your system a unique user which the # ftp server can use as a totally isolated and unprivileged user. #nopriv_user=ftpsecure # # Enable this and the server will recognise asynchronous ABOR requests. Not # recommended for security (the code is non-trivial). Not enabling it, # however, may confuse older FTP clients. #async_abor_enable=YES # # By default the server will pretend to allow ASCII mode but in fact ignore # the request. Turn on the below options to have the server actually do ASCII # mangling on files when in ASCII mode. # Beware that on some FTP servers, ASCII support allows a denial of service # attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd # predicted this attack and has always been safe, reporting the size of the # raw file. # ASCII mangling is a horrible feature of the protocol. #ascii_upload_enable=YES #ascii_download_enable=YES # # You may fully customise the login banner string: ftpd_banner=Welcome to mmall FTP Server # # You may specify a file of disallowed anonymous e-mail addresses. Apparently # useful for combatting certain DoS attacks. #deny_email_enable=YES # (default follows) #banned_email_file=/etc/vsftpd/banned_emails # # You may specify an explicit list of local users to chroot() to their home # directory. If chroot_local_user is YES, then this list becomes a list of # users to NOT chroot(). chroot_local_user=NO chroot_list_enable=YES # (default follows) chroot_list_file=/etc/vsftpd/chroot_list # # You may activate the "-R" option to the builtin ls. This is disabled by # default to avoid remote users being able to cause excessive I/O on large # sites. However, some broken FTP clients such as "ncftp" and "mirror" assume # the presence of the "-R" option, so there is a strong case for enabling it. #ls_recurse_enable=YES # # When "listen" directive is enabled, vsftpd runs in standalone mode and # listens on IPv4 sockets. This directive cannot be used in conjunction # with the listen_ipv6 directive. listen=YES # # This directive enables listening on IPv6 sockets. To listen on IPv4 and IPv6 # sockets, you must run two copies of vsftpd with two configuration files. # Make sure, that one of the listen options is commented !! #listen_ipv6=YES pam_service_name=vsftpd userlist_enable=YES tcp_wrappers=YES #pasv_enable=YES pasv_min_port=61001 pasv_max_port=62000
【配置防火墙端口范围】 + iptables 起到一个限制的做用
sudo vim /etc/vsftpd/vsftpd.conf
pasv_min_port=61001
pasv_max_port=62000
【防火墙配置】sudo vim /etc/sysconfig/iptables
# Generated by iptables-save v1.4.7 on Fri Jan 6 16:53:09 2017 #*filter #:INPUT ACCEPT [174:12442] #:FORWARD ACCEPT [0:0] #:OUTPUT ACCEPT [96:10704] #-A INPUT -p tcp -m tcp --dport 3306 -j ACCEPT #-A INPUT -p tcp -m state --state NEW -m tcp --dport 21 -j ACCEPT #-A INPUT -p tcp -m tcp --dport 8080 -j ACCEPT #COMMIT # Completed on Fri Jan 6 16:53:09 2017 #------------------------------------ # Firewall configuration written by system-config-firewall # Manual customization of this file is not recommended. *filter :INPUT ACCEPT [0:0] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [0:0] -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT -A INPUT -p icmp -j ACCEPT -A INPUT -i lo -j ACCEPT #ssh port -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT #vsftpd -A INPUT -p TCP --dport 61001:62000 -j ACCEPT -A OUTPUT -p TCP --sport 61001:62000 -j ACCEPT -A INPUT -p TCP --dport 20 -j ACCEPT -A OUTPUT -p TCP --sport 20 -j ACCEPT -A INPUT -p TCP --dport 21 -j ACCEPT -A OUTPUT -p TCP --sport 21 -j ACCEPT #mysql port -A INPUT -p tcp -m tcp --dport 3306 -j ACCEPT #tomcat remote debug port -A INPUT -p tcp -m tcp --dport 5005 -j ACCEPT -A INPUT -p tcp -m tcp --dport 8080 -j ACCEPT #nginx -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT -A INPUT -j REJECT --reject-with icmp-host-prohibited -A FORWARD -j REJECT --reject-with icmp-host-prohibited COMMIT
sudo service iptables restart
【验证 very secure ftp daemon】
sudo service vsftd restart
=>浏览器 ftp://ifconfig ftpuser 123456
=>终端 ftp ip 一样输入密码
=> filezilla
………………………………………………………………【vsftpd】
………………………………………………………………【nginx】
反向代理服务器 => 负载均衡服务器 => 邮件代理服务器 => 前端静态和动态分离
【安装依赖】
yum -y install gcc-c++ zlib zlib-devel pcre-devel openssl openssl-devel
【tar -zvxf】
【默认安装】/usr/local/nginx 查 whereis nginx
cd 进入 ./configure (可选指定本身想要的安装路径 --prefix=/developer/nginx )
make
make install
【经常使用命令】
测试或检查配置文件 nginx/sbin/nginx -t
启动命令 nginx/sbin/nginx 启动后 ps aux | grep nginx 打开浏览器看下
中止命令 nginx/sbin/nginx -s stop
重启命令 nginx/sbin/nginx -s reload
平滑重启(热) kill -HUP pid
查看进程 ps -ef | grep nginx
【开发防火墙 80端口】
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
【验证】
启动 ${nginx}/sbin/nginx
重启 ${nginx}/sbin/nginx -s reload ==========
http://ifconfig 访问 80 端口
………………………………………………………………………………………………………………………………
【配置可维护的 vhost】nginx 虚拟域名的配置
sudo vim /usr/local/nginx/conf/nginx.conf
追加 include vhost/*.conf;
cd /usr/local/nginx/conf
mkdir vhost
【建立域名转发配置文件】
learning.istone.com.conf
istone.com.conf
img.istone.com.conf
s,istone.com.conf
【没有本身的域名 能够先用 Host 须要重启浏览器】
【linux桌面下】sudo vim /etc/hosts
192.168.222 www.izxvf.com
【建立 vhost conf 域名转发】从nginx.conf 分离出来 include部分
cd /usr/local/nginx/conf/vhost/
sudo vim www.izxvf.com.conf
server { listen 80; autoindex on; server_name www.istone.com; access_log /usr/local/nginx/logs/access.log combined; index index.html index.htm index.jsp index.php; #error_page 404 /404.html; if ( $query_string ~* ".*[\;'\<\>].*" ){ return 404; } location / { proxy_pass http://127.0.0.1:8080; add_header Access-Control-Allow-Origin *; } }
【修改完配置重启一下】记住 chrome 强制 https 因此能够删除一下 chrome://net-internals/#hsts
【vhost 图片服务器转发】
cd vhost
sudo vim image.izxvf.com.conf
server { listen 80; autoindex off; server_name image.istone.com; access_log /usr/local/nginx/logs/access.log combined; index index.html index.htm index.jsp index.php; #error_page 404 /404.html; if ( $query_string ~* ".*[\;'\<\>].*" ){ return 404; } location ~ /(mmall_fe|mmall_admin_fe)/dist/view/* { deny all; } location / { root /ftpfile/ftpfile/; add_header Access-Control-Allow-Origin *; } }
【vhost 静态资源服务器 示例】autoindex off 关掉索引
server { listen 80; autoindex off; server_name s.happymmall.com; access_log /usr/local/nginx/logs/access.log combined; index index.html index.htm index.jsp index.php; if ( $query_string ~* ".*[\;'\<\>].*" ){ return 404; } location ~ /(mmall_fe|mmall_admin_fe)/dist/view/* { deny all; } location / { root /product/front/; add_header Access-Control-Allow-Origin *; } }
………………………………………………………………【nginx】
………………………………………………………………【nginx + vsftpd】
经过程序上传文件到 vsftpd
而后 nginx 获得 文件 url。
………………………………………………………………【nginx + vsftpd】
………………………………………………………………【mysql】
【安装】yum -y install mysql-server
【默认配置】/etc/my.cnf
【字符集配置】
sudo vim /etc/my.cnf
[mysqld]
default-character-set=utf8mb4
character-set-server=utf8mb4
【5.1 版本中文乱码】
my.ini 的 [mysql] 和 [mysqld] 【default-character-set=utf8】
【5.5 版本中文乱码】
my.ini 的 [mysqld] 更改成 【character-set-server=utf8】
【自启动配置】
chkconfig mysqld on
chkconfig --list mysqld 查看 on 状态 2到5位。
【防火墙配置】入站 开放 3306
【启动 mysqld 服务】service mysqld start
【查看目前 mysql 用户】select user,host,passwd from mysql.user;
=> 【删除匿名用户 执行下】delete from mysql.user where user='';
=>【刷薪后生效】flush privileges;
【修改下密码】set passwd for root@localhost=passwd('youpasswd');
【添加一个用户】
insert into mysql.user(Host,User,Password) values ("localhost","yourusername",password("yourpassword"));
=>【刷薪后生效】flush privileges
【建立新的数据库】create database `mmall` default character set utf8 collate utf8_general_ci;
【查看已经有的全局权限】select * from mysql.user \G -- 有可能已经赋值了Y 可是 N。
【赋予全部权限】grant all privileges on mmall.* to yourusername@127.0.0.1 identified by 'yourpassword'
【开通外网权限】grant all privileges on mmall.* to yourusername@'%' identified by 'yourpassword'
【赋予部分权限】grant select,update,insert ...
=>【刷薪后生效】flush privileges
………………………………………………………………【mysql】
………………………………………………………………【git】
【安装依赖】sudo yum -y install zlib-devel openssl-devel cpio expat-devel gettext-devel curl-devel perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker
sudo make prefix=/usr/local all
sudo make prefix=/usr/local install
【配置】git config --global user.name "your"
git config --gloabl user.email "@email"
【其余配置】
[kdiff3软件]git config --global merge.tool "kdiff3"
【windows 和 linux 换行符】git config --global core.autocrlf false;
【git gui 乱码】git config --global gui.encoding utf-8
【git status 乱码】git config --global core.quotepath off
【windows 设置一下】git config --global core.ignorecase false
【ssh key pair】
ssh-keygen -t rsa -C "i@email."
ssh-add ~/.ssh/id_rsa
=> 报错 eval `ssh-agent` 再 ssh-add ~... => ssh-add -l
【验证】git --version
【git 经常使用命令】
git branch -r
git checkout 要切换分支
git branch 当前分支
………………………………………………………………【git】
========================================【数据库设计】
有些设计技巧 => 放到个人 《数据库概要设计》那边总结 https://www.cnblogs.com/chenhui7373/p/9076608.html
========================================【数据库设计】