linux安装软件

安装jdk

上传jdk.tar.gz包(免安装)
解压到指定目录
[root@localhost usr]# tar -zxvf jdk-8u171-linux-x64.tar.gz
配置环境变量
#jdk安装位置:/user/java/jdk1.8.0_171

#用户环境变量位置: /root/.bash_profile
#系统环境变量位置: /etc/profile

[root@localhost usr]# vi /root/.bash_profile #用户环境变量

[root@localhost ~]# vi /etc/profile  #系统环境变量


#文件末尾添加

export JAVA_HOME=/usr/java/jdk1.8.0_171

export CLASSPATH=$:CLASSPATH:$JAVA_HOME/lib/

export PATH=$PATH:$JAVA_HOME/bin

重启
[root@localhost ~]# source /etc/profile

[root@localhost ~]# source /root/.bash_profile

安装MySQL

安装前,检测系统是否自带MySQL
[root@localhost ~]# rpm -qa | grep mysql
如果系统有安装,可以选择进行卸载:
[root@localhost ~]# rpm -e mysql  // 普通删除模式
[root@localhost ~]# rpm -e --nodeps mysql  // 强力删除模式,如果使用上面命令删除时,提示有依赖的其它文件,则用该命令可以对其进行强力删除
安装wget
[root@localhost ~]# yum -y install wget
安装MySQL(centos7)
[root@localhost ~]# wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
[root@localhost ~]# rpm -ivh mysql-community-release-el7-5.noarch.rpm
[root@localhost ~]# yum update
[root@localhost ~]# yum install mysql-server
权限设置
[root@localhost ~]# chown mysql:mysql -R /var/lib/mysql
初始化MySQL
[root@localhost ~]# mysqld --initialize
启动MySQL
[root@localhost ~]# systemctl start mysqld

#启动报错:Job for mysqld.service failed because the control process exited with error code.
#日志报错:[ERROR] [MY-012271] [InnoDB] The innodb_system data file 'ibdata1' must be writable
#解决方案:
[root@localhost ~]# chmod -R 777 /usr/local/mysql/data/  #mysql5.7以前版本
[root@localhost ~]# chmod -R 777 /var/lib/mysql   #mysql5.7之后版本
查看MySQL运行状态
[root@localhost ~]# systemctl status mysqld
关闭MySQL
[root@localhost ~]# systemctl stop mysqld
重启MySQL
[root@localhost ~]# systemctl restart mysqld
修改密码
[root@localhost ~]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 16
Server version: 5.6.46 MySQL Community Server (GPL)

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> set password=password('123456');
设置开机自启动
[root@localhost ~]# vi /etc/rc.local
#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.

touch /var/lock/subsys/local
service mysqld start 		#设置MySQL开机自启动
centos8安装Mysql
[root@localhost ~]# dnf -y install mysql-server
设置开机自启动
[root@localhost ~]# systemctl enable mysqld
Created symlink /etc/systemd/system/multi-user.target.wants/mysqld.service → /usr/lib/systemd/system/mysqld.service.
[root@localhost ~]# systemctl daemon-reload
修改登录密码
[root@localhost ~]# mysql -u root -p   
Enter password:     #默认无密码,回车直接进入mysql界面
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.0.17 Source distribution

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';

Query OK, 0 rows affected (0.01 sec)
mysql>quit
修改权限
[root@localhost ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 14
Server version: 8.0.17 Source distribution

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use mysql;   #选择mysql库
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> select 'host' from user where user='root';  #查看mysql库中的user表的host值(即可进行连接访问的主机/IP名称)
+------+
| host |
+------+
| host |
+------+
1 row in set (0.00 sec)

mysql> update user set host = '%' where user ='root';  #修改host值(以通配符%的内容增加主机/IP地址),当然也可以直接增加IP地址
Query OK, 1 row affected (0.01 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> flush privileges;  #刷新MySQL的系统权限相关表
Query OK, 0 rows affected (0.01 sec)

mysql> select 'host'   from user where user='root';
+------+
| host |
+------+
| host |
+------+
1 row in set (0.00 sec)

mysql> quit
Bye
[root@localhost ~]# systemctl restart mysqld  #重启mysql服务

安装zookeeper

tar包离线安装
#安装
[root@localhost ~]# tar zxvf zookeeper-3.4.14.tar.gz -C /usr
[root@localhost ~]# cp /usr/zookeeper-3.4.14/conf/zoo_sample.cfg /usr/zookeeper-3.4.14/conf/zoo.cfg
#启动
[root@localhost ~]# cd /usr/zookeeper-3.4.14/bin/
[root@localhost bin]# ./zkServer.sh start ../conf/zoo.cfg
ZooKeeper JMX enabled by default
Using config: ../conf/zoo.cfg
Starting zookeeper ... STARTED
[root@localhost bin]# jps
2024 QuorumPeerMain
2041 Jps
#停止
[root@localhost bin]# ./zkServer.sh stop ../conf/zoo.cfg
ZooKeeper JMX enabled by default
Using config: ../conf/zoo.cfg
Stopping zookeeper ... STOPPED
在线安装
#安装wget
[root@localhost zookeeper]# yum -y install wget
#下载zookeeper
[root@localhost zookeeper]# wget https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/zookeeper-3.6.1/apache-zookeeper-3.6.1-bin.tar.gz
#解压 安装
[root@localhost zookeeper]# tar -zxvf apache-zookeeper-3.6.1-bin.tar.gz
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值