二进制安装
案例:二进制安装JDK
JDK下载
http://www.oracle.com/
步骤1)上传jdk的二进制安装包 jdk-8u221-linux-x64.tar.gz,比如上传到/root/下
步骤2)解压jdk安装包
[root@hadoop01 ~]# tar -zxvf ./jdk-8u221-linux-x64.tar.gz -C /usr/local
步骤3)切换到/usr/local下并更名
[root@hadoop01 ~]# cd /usr/local
[root@hadoop01 local]# mv jdk1.8.0_221/ jdk
步骤4)配置环境变量
[root@hadoop01 ~]#vim /etc/profile
........省略...................
# JDK environment
JAVA_HOME=/usr/local/jdk
PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
步骤5)让环境变量生效(刷新环境变量)
[root@hadoopg01 ~]# source /etc/profile
步骤6)验证是否生效
[root@hadoop01 ~]# java -version
[root@hadoop01 ~]# javac
rpm机制安装
案例:rpm安装mysql
MySQL下载
https://dev.mysql.com/downloads/repo/yum/
步骤1)上传mysql相关的软件包,比如上传到/root下
mysql-5.7.28-1.el7.x86_64.rpm-bundle.tar
步骤2)拆包
[root@hadoop01 ~]# tar -xvf mysql-5.7.28-1.el7.x86_64.rpm-bundle.tar
[root@hadoop01 ~]# ll
mysql-community-client-5.7.28-1.el7.x86_64.rpm
mysql-community-common-5.7.28-1.el7.x86_64.rpm
mysql-community-devel-5.7.28-1.el7.x86_64.rpm
mysql-community-embedded-5.7.28-1.el7.x86_64.rpm
mysql-community-embedded-compat-5.7.28-1.el7.x86_64.rpm
mysql-community-embedded-devel-5.7.28-1.el7.x86_64.rpm
mysql-community-libs-5.7.28-1.el7.x86_64.rpm
mysql-community-libs-compat-5.7.28-1.el7.x86_64.rpm
mysql-community-server-5.7.28-1.el7.x86_64.rpm
mysql-community-test-5.7.28-1.el7.x86_64.rpm
找到mysql-community-server-5.7.28-1.el7.x86_64.rpm
步骤3)安装mysql
1. 先检查是否安装了mariadb, 如果已经安装,就卸载掉
[root@hadoop01 ~]# rpm -qa | grep mariadb
mariadb-libs-5.5.64-1.el7.x86_64
[root@qianfeng01 ~]# rpm -e mariadb-libs-5.5.64-1.el7.x86_64 --nodeps
2. 安装mysql-common
[root@hadoop01 ~]# rpm -ivh mysql-community-common-5.7.28-1.el7.x86_64.rpm
3. 安装mysql-lib
[root@hadoop01 ~]# rpm -ivh mysql-community-libs-5.7.28-1.el7.x86_64.rpm
4. 安装mysql-client
[root@hadoop01 ~]# rpm -ivh mysql-community-client-5.7.28-1.el7.x86_64.rpm
5. 安装mysql-server
[root@hadoop01 ~]# rpm -ivh mysql-community-server-5.7.28-1.el7.x86_64.rpm
rpm安装完毕
mysql在linux中的服务项叫mysqld
6. 启动mysql的服务项mysqld
[root@hadoop01 ~]# systemctl start mysqld
[root@hadoop01 ~]# systemctl status mysqld 并查看
7. 查看mysql提供的默认密码,并复制, 注意,如果服务项启动失败,则不会产生mysqld.log文件
[root@hadoop01 ~]# cat /var/log/mysqld.log | grep password
8. 登录mysql,并修改密码
[root@hadoop01 ~]# mysql -uroot -p'9Pe%mQVcs-#<' 回车即可
… 进入后,修改密码
mysql> alter user root@'localhost' identified by '@Mmforu45';
9. 如果想要远程连接该机器上的mysql server, 那么mysql server需要进行远程授权
mysql> grant all privileges on *.* to root@'%' identified by '@MeiGT8848';
然后可以在windows启动navicat 远程连接linux上的mysql了。
yum在线安装
语法:yum [install | update| reinstall | remove ] [软件名称]
yum install appname 安装
yum reinstall appname 重新安装
yum update appname 升级
yum remove appname 卸装