一聚教程网:一个值得你收藏的教程网站

热门教程

CentOS7安装mariaDB、jdk1.8、redis数据库例子

时间:2022-06-29 10:47:50 编辑:袖梨 来源:一聚教程网


这个是centos7自带的数据库MariaDB,以前是mysql,到7以后,改为MariaDB。。。

 

1. MariaDB安装,没有往深处配置。。。懒得动了。。参考:http://blog.csdn.net/default7/article/details/41973887

    a:yum install mariadb mariadb-server

    b:systemctl start mariadb ==> 启动mariadb

    c:systemctl enable mariadb ==> 开机自启动

    d:mysql_secure_installation ==> 设置 root密码等相关

    e:mysql -uroot -p123456 -h127.0.0.1 ==> 测试登录!

 

2. jdk安装。

  参考地址:1. http://www.jb51.net/os/RedHat/73016.html

           2. http://blog.csdn.net/czmchen/article/details/41047187

  换汤不换药,三部曲;1. 下载,2.看装过没,3. 安装&配置环境

  rpm安装法,不会的去百度。。。很简单的。。上面参考的教程也有。

3. redis

  安装必要包:

yum install gcc

下载:ps:如果没有wget命令,执行:yum install wget;(这个方案是通用的,如果有命令没有安装,一般这种办法都可以安装出来的。。我挺喜欢这个功能的。。)

wget http://download.redis.io/releases/redis-3.2.3.tar.gz

解压:

tar zxvf redis-3.2.3.tar.gz

进入目录,分配内存:  

 cd redis-3.2.3      # 进入目录

 make MALLOC=libc    # 不执行,会报错。

配置系统启动:./utils/install_server.sh

[root@localhost redis-3.2.3]# ./utils/install_server.sh
Welcome to the redis service installer
This script will help you easily set up a running redis server

Please select the redis port for this instance: [6379] 6379
Please select the redis config file name [/etc/redis/6379.conf] /etc/redis/6379.conf
Please select the redis log file name [/var/log/redis_6379.log] /logs/redis/redis_6379.log
Please select the data directory for this instance [/var/lib/redis/6379]
Selected default - /var/lib/redis/6379
Please select the redis executable path [/usr/local/bin/redis-server] /usr/local/bin/redis-server
Selected config:
Port           : 6379
Config file    : /etc/redis/6379.conf
Log file       : /logs/redis/redis_6379.log
Data dir       : /var/lib/redis/6379
Executable     : /usr/local/bin/redis-server
Cli Executable : /usr/local/bin/redis-cli
Is this ok? Then press ENTER to go on or Ctrl-C to abort.
Copied /tmp/6379.conf => /etc/init.d/redis_6379
Installing service...
Successfully added to chkconfig!
Successfully added to runlevels 345!
Starting Redis server...
Installation successful!

Redis服务查看、开启、关闭

1、通过ps -ef|grep redis命令查看Redis进程;

2、开启Redis服务操作通过/etc/init.d/redis_6379 start命令,也可通过(service redis_6379 start);

3、关闭Redis服务操作通过/etc/init.d/redis_6379 stop命令,也可通过(service redis_6379 stop);

热门栏目