tomcat:
tomcat服务器的默认访问路径是webapps目录下的ROOT。如果更改tomcat服务器下的默认访问工程,需要修改tomcat/conf/server.xml配置文件:
打开server.xml可以找到类似下面的配置:
<
Host
name
=
"localhost"
appBase
=
"webapps"
unpackWARs
=
"true"
autoDeploy
=
"true"
xmlValidation
=
"false"
xmlNamespaceAware
=
"false"
>
</
Host
>
<
Context
path
=
""
docBase
=
"项目名称"
reloadable
=
"true"
debug
=
"0"
privileged
=
"true"
>
</
Context
>
**************************************************************
ps -ef |grep tomcat
mysql安装:
1.查看本机是否安装mysql,sudo rpm -qa | grep mysql-server
2.sudo -y install mysql-server (等待安装完成)
3.sudo vim /etc/my.cnf (修改mysql字符集)
添加两项
character-set-server=utf8
default-character-set=utf8保存退出:wq
4.配置mysql自启动:sudo chkconfig mysql on
5. 查看一下:sudo chkconfig --list mysqld:
mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off (配置成功,服务器启动,mysql自动启动)
6.启动一下:sudo service mysqld restart
7.登录一下mysql:mysql -u root (提示:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)需要密码:mysql -r root -p 然后提示输入密码:123)
8.查看mysql用户:select user,host,password from mysql.user
9.修改密码:set password for root@localhost = password('rootpassword');
10.删除匿名用户:delete from mysql.user where user='';
11.刷新一下:flush privileges;
12.添加用户:insert into mysql.user(host,user,password) values("localhost","mmall",password("mmallpassword"));
13.创建数据库:create database `mmall` default character set uft8_general_ci
14.查看数据库:show databases;
15.赋予用户一个数据库全部权限:grant all privileges on mmall.* to mmall@localhost identified by 'mmallpassword';(如果出现:ERROR 1133(42000):Can't find any matching row int the user table (需要flush privileges;)
16.导入sql文件:首先下载sql文件:然后登陆mysql:mysql -u root -p 打开数据库:show databases; use mmall; show tables;执行sql文件:source /developer/mmall.sql 然后show tables; 导入成功
**************************************************************
查找mysql安装路径:which mysql
退出mysql: exit
git安装:
1.下载安装包:
sudo wget http://learning.happymmall.com/git/git-v2.8.0.tar.gz
2.安装git依赖包:
sudo yum -y install zlib-devel openssl-devel cpio expat-devel gettext-devel curl-devel perl-ExtUtils-CBuilder perl-ExtUtils- MakeMaker
3.解压git压缩包后进入目录
sudo tar -zxvf git-v2.8.0.tar.gz
cd git-2.8.0/
4.sudo make prefix=/usr/local/git all
5.sudo make prefix=/user/local/git install
6.查看git:git --version(提示:command not found)
7.查看git安装到哪里了 whereis git(提示:git: /usr/local/bin/git)之前安装过了
8.配置环境变量:sudo vim /etc/profile:
"PATH="后边添加一条git路径(/usr/local/git/bin:)
然后保存退出:wq!
9.配置生效:source /etc/profile
10.这是查看版本:git --version(提示:git version 2.8.0) 配置成功;
11.配置用户名:
git config --global user.name "immoc"
git config --global user.email "531837586@qq.com"
git config --global core.autocrlf false (配置windows和linux自动换行符转换)
git config --global core.quotepath off (避免中文乱码)
git config --global gui.encoding utf-8
ssh-keygen -t rsa -C "531837586@qq.com"
一路回车
ssh-add ~/.ssh/id_rsa(如果出现:Could not open a connection to your authentication agent.输入:eval `ssh-agent`)
然后在执行 ssh-add ~/.ssh/id_rsa(提示Identity added: /root/.ssh/id_rsa (/root/.ssh/id_rsa)成功)
看一下rsa公钥:cat ~/.ssh/id_rsa.pub
复制到代码托管平台
线上防火墙配置:
1.进入防火墙目录:cd /etc/sysconfig/(查看比对命令:ll | grep ipt)
2.如果没有iptables:初始化防火墙(就是随便添加规则)
sudo iptables -P OUTPUT ACCEPT (输入密码)
sudo service iptables save(提示:iptables: Saving firewall rules to /etc/sysconfig/iptables:[OK]成功)
这时 ll | grep ipt 出现iptables
3.备份一下iptables:sudo mv iptables iptables.bak
4.配置一下iptables。保存退出,重启防火墙:sudo service iptables restart
服务端自动化发布:
1.脚本wget到develop
2.创建目录:
sudo mkdir git-repository 进入目录:cd git-repository
3.复制项目ssh克隆地址并克隆到本地:
git clone git@gitee.com:fanxing5211/mmall_learning.git(可能提示:could not create work tree dir mmall_learning:permission denied, 添加sudo后提示command no found)需要配置权限退出到上层目录:
sudo chown -R geely /developer/ (赋予geely拥有者权限)
sudo chmod u+w -R /developer/ (赋予写权力)
sudo chmod u+r -R /developer/ (赋予读权利)
sudo chmod u+x -R /developer/ (赋予执行权利)
4.配置和执行脚本:
./deploy.sh (出现:-bash: ./deploy.sh: Permission denied)无执行权限
sudo chmod u+x -R deploy.sh (赋予执行权限)
5.进入tomcat:cd webapps/ cd ROOT cat index.jsp
**************************************************************
(mvn: command not found) Maven的环境变量没有配置: mv apache-maven-3.2.3 /usr/local/maven3 配置环境变量:
修改环境变量,在/etc/profile中添加以下几行
记得执行source /etc/profile
使环境变量生效。
最后运行mvn -v
验证maven是否安装成功,如果安装成功会打印如下内容