练手项目
停车场系统
安装python
安装依赖
通过 gcc --version 查看,没安装的先安装 yum -y install gcc
安装其它依赖包 yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel libffi-devel
python下载与解压
下载 wget https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tgz
解压 tar -zxvf Python-3.7.3.tgz
创建目录 mkdir /usr/local/python3
编译
cd Python-3.6.5
./configure --prefix=/usr/local/python3
make && make install
创建软链
ln -s /usr/local/python3/bin/python3.7 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3.7 /usr/bin/pip3
查看版本号 python3 -V(pip3 -V)
mysql安装
安装命令 yum -y install mariadb mariadb-server
安装完成MariaDB,首先启动MariaDB systemctl start mariadb
设置开机启动 systemctl enable mariadb
取消开机启动 systemctl disable mariadb
项目包处理
解压ParkingSys-master.zip代码包到当前目录
进入源码目录 /opt/ParkingSys-master/ParkingSysApi
安装程序依赖包
pip3 install -r requirements.txt
pip3 install -r requirements.txt --trusted-host=pypi.python.org --trusted-host=pypi.org --trusted-host=files.pythonhosted.org
创建数据库
进入数据库使用mysql -u root -p CREATE DATABASE parking CHARSET=UTF8
找到config.py 数据的密码设定好,如果没有密码把 :123456 去除掉
启动停车场系统
切换目录 cd /opt/ParkingSys-master
启动停车场系统 执行 python3 apprun.py &
navicat客户端连接数据库,更改mysql数据权限表
1.进入数据库 mysql -u root -p
2. use mysql;
3. update user set Host = '%' where User = 'root' and Host = 'localhost.localdomain';
重新启动数据库 systemctl restart mariadb
关闭防火墙(已经关闭的时候可以忽略) systemctl stop firewalld systemctl disable firewalld
本地连接不上Linux虚拟机mysql
进入到数据库 mysql -u root -p
输入命令进行权限设置 grant all privileges on . to root@"%" identified by "密码";(这表示是给本地ip赋予了所有的权限,包括远程访问权限,%百分号表示允许任ip访问数据库。)
重新加载 flush privileges;
重启数据库 systemctl restart mariadb
国家电网
安装centos7操作系统
检查网络,配置网络参数
ip addr 查看IP地址
/etc/sysconfig/network-scripts/ifcfg-ens33网卡配置文件,将onboot=no改为yesIPV6开头的配置项全部#注释掉
重启操作系统reboot systemctl restart network
改为桥接模式继续重启 systemctl restart network
/opt目录下安装JDK
tar -zxvf jdk-8u144-linux-x64.tar.gz(可使用命令 wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u141-b15/336fa29ff2bb4ef291e347e091f7f4a7/jdk-8u141-linux-x64.tar.gz ")
vi /etc/profile,在profile下添加如下:
export JAVA_HOME=/opt/jdk1.8.0_144
export PATH=\(JAVA_HOME/bin:\) PATH
export CLASSPATH=.:\(JAVA_HOME/lib/dt.jar:\) JAVA_HOME/lib/tools.jar
source /etc/profile
java -version 检查jdk安装是否完好
在添加环境的时候,执行之后,导致vi命令不能使用的时候使用如下命令 export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/us
/opt 安装tomcat中间件
tar zxvf apache-tomcat-7.0.82.tar.gz
目录apache-tomcat-7.0.82名称修改为tomcat
命令关闭防火墙(先查看是否关闭,已经关闭忽略此步骤) systemctl stop firewalld #停止firewall systemctl disable firewalld #禁止firewall开机启动
启动tomcat tomcat/bin/startup.sh
用浏览器访问,http://:8080 测试tomcat安装是否完好
安装mysql数据库
yum -y install mariadb mariadb-server
启动MariaDB systemctl start mariadb
设置开机启动 systemctl enable mariadb
修改数据库密码(可以不做)mariadb root用户,密码默认为空 mysql_secure_installation
部署应用
将KBMS.war拷贝到tomcat/webapps/目录下
使用脚本创建数据库以及表 mysql -u root -p 以root用户登录数据库 mysql
source /opt/KBMS.sql
配置数据库连接
将KBMS.xml数据库配置文件拷贝到tomcat/conf/Catalina/localhost/并且打开修改数据库密码为空 vi tomcat/conf/Catalina/localhost/KBMS.xml→password=""
打开/etc/my.cnf 在[mysqld]下添加skip-grant-tables
重新启动mysql
systemctl stop mariadb
systemctl start mariadb
重新启动tomcat
tomcat/bin/shutdown.sh
tomcat/bin/startup.sh
浏览器打开应用 http://{ip地址}:8080/KBMS
修改tomcat默认端口号(8080)tomcat/conf/server.xml 将8080修改为80
浏览器再次打开应用 http://{ip地址}/KBMS
查看tomcat日志
日志所在位置在 tomcat/logs/catalina.out
根据error/excption 去查找错误内容
mysql默认端口号是3306 oracle 默认端口号是1521
posted @
2020-11-18 09:00
SunFree
阅读(
144 )
评论()
编辑
收藏
举报