mkdir /usr/local/java
3.移动安装文件到目录
mv ~/jdk-8u11-linux-x64.tar.gz /usr/local/java
4.解压文件
tar -zxvf jdk-8u11-linux-x64.tar.gz
5.配置Java环境变量
whereis java //查找java在哪
vim /etc/profile
//输入G到文件末尾,增加2个环境变量
JAVA_HOME=/usr/local/java/jdk1.8.0_11
export PATH=$JAVA_HOME/bin:$PATH
source /etc/profile //从新加载文件
java -version //查看Java环境是否配置成功
cd ~
vim Hello.java
//输入以下内容
public class Hello {
public static void main(String[] args) {
System.out.println("hello java");
}
}
2.编译
javac Hello.java
3.运行
java Hello
1.把下载的文件上传到虚拟机
mv ~/apache-tomcat-8.5.56.tar.gz /usr/local/java
tar -zxvf apache-tomcat-8.5.56.tar.gz
3.运行tomcat
/usr/local/java/apache-tomcat-8.5.56/bin/startup.sh //启动
jps //java的一个工具,跟javac一样,查看java的进程
4.测试
测试修改/usr/local/java/apache-tomcat-8.5.56/webapps/ROOT/index.jsp
添加welcome to tomact
vim /usr/local/java/apache-tomcat-8.5.56/webapps/ROOT/index.jsp
curl http://localhost:8080/index.jsp //curl用于传输来自服务器或者到服务器的数据
1.下载Mysql
cd ~
tar -zxvf mysql-5.7.28-linux-glibc2.12-x86_64.tar.gz
mv mysql-5.7.28-linux-glibc2.12-x86_64 mysql-5.7.28
mv mysql-5.7.28 /usr/local/ //移动到local下
cat /etc/group|grep mysql
groupadd mysql
useradd -r -g mysql mysql //useradd -r参数表示mysql用户是系统用户,不可用于登录系统
cd /usr/local/mysql-5.7.28
mkdir data
chown -R mysql.mysql /usr/local/mysql-5.7.28
cd /usr/local/mysql-5.7.28/support-files
vim my_default.cnf
[mysqld]
#设置mysql的安装目录
basedir =/usr/local/mysql-5.7.28
#设置mysql数据库的数据存放目录
datadir = /usr/local/mysql-5.7.28/data
#设置端口
port = 3306
socket = /tmp/mysql.sock
#设置字符集
character-set-server=utf8
#日志存放目录
log-error = /usr/local/mysql-5.7.28/data/mysqld.log
pid-file = /usr/local/mysql-5.7.28/data/mysqld.pid
#允许时间类型的数据为零(去掉NO_ZERO_IN_DATE,NO_ZERO_DATE)
sql_mode=ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
#ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
cp my_default.cnf /etc/my.cnf
cd /usr/local/mysql-5.7.28/
./bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql-5.7.28/ --datadir=/usr/local/mysql-5.7.28/data/
yum install libaio
cat /usr/local/mysql-5.7.28/data/mysqld.log
cp support-files/mysql.server /etc/init.d/mysql
service mysql start
cd /usr/local/mysql-5.7.28
./bin/mysql -u root -p 上面生成的初始化密码
mysql> set password=password('123456');
mysql> grant all privileges on *.* to root@'%' identified by '123456';
mysql> flush privileges;
mysql> use mysql;
mysql> update user set host='%' where user = 'root';
mysql> flush privileges;
service mysql restart
service mysql stop