centos下安装redis/mysql等基础环境
1、修改语言
阿里云的ECS默认语言是:en_US.UTF-8,需要改成zh_CN.UTF-8
修改方法:vim /etc/locale.conf,然后重启。
查看方法:echo $LANG
2、安装ab(ApacheBench)

[root@iZ23n2t9gynZ ~]# yum install httpd-tools
已加载插件:langpacks
base | 3.6 kB 00:00:00
epel | 4.3 kB 00:00:00
extras | 3.4 kB 00:00:00
updates | 3.4 kB 00:00:00
(1/7): base/7/x86_64/group_gz | 154 kB 00:00:00
(2/7): epel/x86_64/group_gz | 169 kB 00:00:00
(3/7): epel/x86_64/updateinfo | 368 kB 00:00:00
(4/7): extras/7/x86_64/primary_db | 87 kB 00:00:00
(5/7): epel/x86_64/primary_db | 3.6 MB 00:00:00
(6/7): base/7/x86_64/primary_db | 5.1 MB 00:00:01
(7/7): updates/7/x86_64/primary_db | 4.0 MB 00:00:01
正在解决依赖关系
--> 正在检查事务
---> 软件包 httpd-tools.x86_64.0.2.4.6-31.el7.centos.1 将被 安装
--> 解决依赖关系完成 依赖关系解决 =============================================================================================================================================================
Package 架构 版本 源 大小
=============================================================================================================================================================
正在安装:
httpd-tools x86_64 2.4.6-31.el7.centos.1 updates 79 k 事务概要
=============================================================================================================================================================
安装 1 软件包 总下载量:79 k
安装大小:168 k
Is this ok [y/d/N]: y
Downloading packages:
httpd-tools-2.4.6-31.el7.centos.1.x86_64.rpm | 79 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : httpd-tools-2.4.6-31.el7.centos.1.x86_64 1/1
验证中 : httpd-tools-2.4.6-31.el7.centos.1.x86_64 1/1 已安装:
httpd-tools.x86_64 0:2.4.6-31.el7.centos.1 完毕!

3、安装mysql
先查看yum上提供的数据库可下载版本

[root@iZ23n2t9gynZ ~]# yum list | grep mysql
akonadi-mysql.x86_64 1.9.2-4.el7 base
apr-util-mysql.x86_64 1.5.2-6.el7 base
calligra-kexi-driver-mysql.x86_64 2.9.7-1.el7 epel
collectd-mysql.x86_64 5.5.0-2.el7 epel
dmlite-plugins-mysql.x86_64 0.7.4-1.el7 epel
dovecot-mysql.x86_64 1:2.2.10-4.el7_0.1 base
dpm-copy-server-mysql.x86_64 1.8.10-1.el7 epel
dpm-name-server-mysql.x86_64 1.8.10-1.el7 epel
dpm-server-mysql.x86_64 1.8.10-1.el7 epel
dpm-srm-server-mysql.x86_64 1.8.10-1.el7 epel
dspam-mysql.x86_64 3.10.2-11.el7 epel
exim-mysql.x86_64 4.84-4.el7 epel
freeradius-mysql.x86_64 3.0.4-6.el7 base
fts-mysql.x86_64 3.3.1-3.el7 epel
gnokii-smsd-mysql.x86_64 0.6.31-10.el7 epel
holland-mysqldump.noarch 1.0.10-3.el7 epel
holland-mysqllvm.noarch 1.0.10-3.el7 epel
lfc-server-mysql.x86_64 1.8.10-1.el7 epel
libdbi-dbd-mysql.x86_64 0.8.3-16.el7 base
libgda-mysql.x86_64 1:5.1.2-2.el7.1 epel
libnss-mysql.x86_64 1.5-19.el7 epel
libodb-mysql.x86_64 2.3.0-1.el7 epel
libodb-mysql-devel.x86_64 2.3.0-1.el7 epel
lighttpd-mod_mysql_vhost.x86_64 1.4.37-1.el7 epel
mysql++.x86_64 3.1.0-12.el7 epel
mysql++-devel.x86_64 3.1.0-12.el7 epel
mysql++-manuals.x86_64 3.1.0-12.el7 epel
mysql-connector-java.noarch 1:5.1.25-3.el7 base
mysql-connector-odbc.x86_64 5.2.5-6.el7 base
mysql-connector-python.noarch 1.1.6-1.el7 epel
mysql-proxy.x86_64 0.8.5-2.el7 epel
mysql-proxy-devel.x86_64 0.8.5-2.el7 epel
mysql-utilities.noarch 1.3.6-1.el7 epel
mysqlreport.noarch 3.5-11.el7 epel
mysqltuner.noarch 1.2.0-7.el7 epel
nagios-plugins-mysql.x86_64 2.0.3-3.el7 epel
nodejs-mysql.noarch 2.3.2-1.el7 epel
opendbx-mysql.x86_64 1.4.6-6.el7 epel
opensips-mysql.x86_64 1.10.5-3.el7 epel
owncloud-mysql.noarch 8.0.8-1.el7 epel
pdns-backend-mysql.x86_64 3.4.6-1.el7 epel
perdition-mysql.x86_64 2.1-2.el7 epel
php-mysql.x86_64 5.4.16-36.el7_1 updates
php-mysqlnd.x86_64 5.4.16-36.el7_1 updates
php-pear-MDB2-Driver-mysql.noarch 1.5.0-0.8.b4.el7 epel
php-pear-MDB2-Driver-mysqli.noarch 1.5.0-0.8.b4.el7 epel
proftpd-mysql.x86_64 1.3.5a-1.el7 epel
qt-mysql.i686 1:4.8.5-8.el7 base
qt-mysql.x86_64 1:4.8.5-8.el7 base
qt5-qtbase-mysql.x86_64 5.4.2-1.el7 epel
redland-mysql.x86_64 1.0.16-6.el7 base
root-sql-mysql.x86_64 5.34.32-3.el7 epel
rsyslog-mysql.x86_64 7.4.7-7.el7_0 base
soci-mysql.x86_64 3.2.3-1.el7 epel
soci-mysql-devel.x86_64 3.2.3-1.el7 epel
voms-mysql-plugin.x86_64 3.1.6-5.el7 epel
zabbix20-proxy-mysql.x86_64 2.0.15-1.el7 epel
zabbix20-server-mysql.x86_64 2.0.15-1.el7 epel
zabbix20-web-mysql.noarch 2.0.15-1.el7 epel
zabbix22-dbfiles-mysql.noarch 2.2.10-1.el7 epel
zabbix22-proxy-mysql.x86_64 2.2.10-1.el7 epel
zabbix22-server-mysql.x86_64 2.2.10-1.el7 epel
zabbix22-web-mysql.noarch 2.2.10-1.el7 epel

然后安装mariadb

[root@iZ23n2t9gynZ ~]# yum install mariadb mariadb-server
已加载插件:langpacks
软件包 1:mariadb-5.5.44-1.el7_1.x86_64 已安装并且是最新版本
正在解决依赖关系
--> 正在检查事务
---> 软件包 mariadb-server.x86_64.1.5.5.44-1.el7_1 将被 安装
--> 正在处理依赖关系 perl-DBI,它被软件包 1:mariadb-server-5.5.44-1.el7_1.x86_64 需要
--> 正在处理依赖关系 perl-DBD-MySQL,它被软件包 1:mariadb-server-5.5.44-1.el7_1.x86_64 需要
--> 正在处理依赖关系 perl(DBI),它被软件包 1:mariadb-server-5.5.44-1.el7_1.x86_64 需要
--> 正在检查事务
---> 软件包 perl-DBD-MySQL.x86_64.0.4.023-5.el7 将被 安装
---> 软件包 perl-DBI.x86_64.0.1.627-4.el7 将被 安装
--> 正在处理依赖关系 perl(RPC::PlServer) >= 0.2001,它被软件包 perl-DBI-1.627-4.el7.x86_64 需要
--> 正在处理依赖关系 perl(RPC::PlClient) >= 0.2000,它被软件包 perl-DBI-1.627-4.el7.x86_64 需要
--> 正在检查事务
---> 软件包 perl-PlRPC.noarch.0.0.2020-14.el7 将被 安装
--> 正在处理依赖关系 perl(Net::Daemon) >= 0.13,它被软件包 perl-PlRPC-0.2020-14.el7.noarch 需要
--> 正在处理依赖关系 perl(Net::Daemon::Test),它被软件包 perl-PlRPC-0.2020-14.el7.noarch 需要
--> 正在处理依赖关系 perl(Net::Daemon::Log),它被软件包 perl-PlRPC-0.2020-14.el7.noarch 需要
--> 正在处理依赖关系 perl(Compress::Zlib),它被软件包 perl-PlRPC-0.2020-14.el7.noarch 需要
--> 正在检查事务
---> 软件包 perl-IO-Compress.noarch.0.2.061-2.el7 将被 安装
--> 正在处理依赖关系 perl(Compress::Raw::Zlib) >= 2.061,它被软件包 perl-IO-Compress-2.061-2.el7.noarch 需要
--> 正在处理依赖关系 perl(Compress::Raw::Bzip2) >= 2.061,它被软件包 perl-IO-Compress-2.061-2.el7.noarch 需要
---> 软件包 perl-Net-Daemon.noarch.0.0.48-5.el7 将被 安装
--> 正在检查事务
---> 软件包 perl-Compress-Raw-Bzip2.x86_64.0.2.061-3.el7 将被 安装
---> 软件包 perl-Compress-Raw-Zlib.x86_64.1.2.061-4.el7 将被 安装
--> 解决依赖关系完成 依赖关系解决 =============================================================================================================================================================
Package 架构 版本 源 大小
=============================================================================================================================================================
正在安装:
mariadb-server x86_64 1:5.5.44-1.el7_1 updates 11 M
为依赖而安装:
perl-Compress-Raw-Bzip2 x86_64 2.061-3.el7 base 32 k
perl-Compress-Raw-Zlib x86_64 1:2.061-4.el7 base 57 k
perl-DBD-MySQL x86_64 4.023-5.el7 base 140 k
perl-DBI x86_64 1.627-4.el7 base 802 k
perl-IO-Compress noarch 2.061-2.el7 base 260 k
perl-Net-Daemon noarch 0.48-5.el7 base 51 k
perl-PlRPC noarch 0.2020-14.el7 base 36 k 事务概要
=============================================================================================================================================================
安装 1 软件包 (+7 依赖软件包) 总下载量:12 M
安装大小:59 M
Is this ok [y/d/N]: y
Downloading packages:
(1/8): perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64.rpm | 32 kB 00:00:00
(2/8): perl-Compress-Raw-Zlib-2.061-4.el7.x86_64.rpm | 57 kB 00:00:00
(3/8): perl-DBD-MySQL-4.023-5.el7.x86_64.rpm | 140 kB 00:00:00
(4/8): perl-DBI-1.627-4.el7.x86_64.rpm | 802 kB 00:00:00
(5/8): perl-Net-Daemon-0.48-5.el7.noarch.rpm | 51 kB 00:00:00
(6/8): perl-IO-Compress-2.061-2.el7.noarch.rpm | 260 kB 00:00:00
(7/8): perl-PlRPC-0.2020-14.el7.noarch.rpm | 36 kB 00:00:00
(8/8): mariadb-server-5.5.44-1.el7_1.x86_64.rpm | 11 MB 00:00:02
-------------------------------------------------------------------------------------------------------------------------------------------------------------
总计 5.1 MB/s | 12 MB 00:00:02
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64 1/8
正在安装 : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64 2/8
正在安装 : perl-IO-Compress-2.061-2.el7.noarch 3/8
正在安装 : perl-Net-Daemon-0.48-5.el7.noarch 4/8
正在安装 : perl-PlRPC-0.2020-14.el7.noarch 5/8
正在安装 : perl-DBI-1.627-4.el7.x86_64 6/8
正在安装 : perl-DBD-MySQL-4.023-5.el7.x86_64 7/8
正在安装 : 1:mariadb-server-5.5.44-1.el7_1.x86_64 8/8
验证中 : perl-Net-Daemon-0.48-5.el7.noarch 1/8
验证中 : 1:mariadb-server-5.5.44-1.el7_1.x86_64 2/8
验证中 : perl-IO-Compress-2.061-2.el7.noarch 3/8
验证中 : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64 4/8
验证中 : perl-PlRPC-0.2020-14.el7.noarch 5/8
验证中 : perl-DBI-1.627-4.el7.x86_64 6/8
验证中 : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64 7/8
验证中 : perl-DBD-MySQL-4.023-5.el7.x86_64 8/8 已安装:
mariadb-server.x86_64 1:5.5.44-1.el7_1 作为依赖被安装:
perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7 perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7 perl-DBD-MySQL.x86_64 0:4.023-5.el7 perl-DBI.x86_64 0:1.627-4.el7
perl-IO-Compress.noarch 0:2.061-2.el7 perl-Net-Daemon.noarch 0:0.48-5.el7 perl-PlRPC.noarch 0:0.2020-14.el7 完毕!

启动mariadb
[root@iZ23n2t9gynZ ~]# systemctl start mariadb
开机自动启动
[root@iZ23n2t9gynZ ~]# systemctl enable mariadb
ln -s '/usr/lib/systemd/system/mariadb.service' '/etc/systemd/system/multi-user.target.wants/mariadb.service'
设置root密码

[root@iZ23n2t9gynZ ~]# mysql_secure_installation
/usr/bin/mysql_secure_installation:行379: find_mysql_client: 未找到命令 NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here. Enter current password for root (enter for none):
OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation. Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success! By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment. Remove anonymous users? [Y/n] y
... Success! Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] y
... Success! By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment. Remove test database and access to it? [Y/n] y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success! Reloading the privilege tables will ensure that all changes made so far
will take effect immediately. Reload privilege tables now? [Y/n] y
... Success! Cleaning up... All done! If you've completed all of the above steps, your MariaDB
installation should now be secure. Thanks for using MariaDB!

登录测试

[root@iZ23n2t9gynZ ~]# mysql -uroot -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 13
Server version: 5.5.44-MariaDB MariaDB Server Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]>

4、安装redis

yum install -y tcl
wget http://download.redis.io/redis-stable.tar.gz
tar xvzf redis-stable.tar.gz
cd redis-stable
make
cd src
make test

配置redis

cd /root/redis-stable cp redis.conf /usr/local/bin cd src cp redis-server /usr/local/bin cp redis-cli /usr/local/bin

配置redis.conf(vim /usr/local/bin/redis.conf)

daemonize yes port 26125 bind 127.0.0.1 # save 900 1 # save 300 10 # save 60 10000 maxclients 60000 maxmemory 500mb

启动与客户端连接

[root@iZ23n2t9gynZ ~]# redis-server /usr/local/bin/redis.conf
[root@iZ23n2t9gynZ ~]# redis-cli -p 26125
127.0.0.1:26125> info
# Server
redis_version:3.0.5
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:8960fb2f771de35e
redis_mode:standalone
os:Linux 3.10.0-123.9.3.el7.x86_64 x86_64
arch_bits:64
multiplexing_api:epoll
gcc_version:4.8.2
process_id:32538
run_id:2b0eb3b85cfcb8c3d37157e12756d6b0bcdcc467
tcp_port:26125
uptime_in_seconds:68
uptime_in_days:0
hz:10
lru_clock:2251601
config_file:/usr/local/bin/redis.conf # Clients
connected_clients:1
client_longest_output_list:0
client_biggest_input_buf:0
blocked_clients:0 # Memory
used_memory:3416888
used_memory_human:3.26M
used_memory_rss:9699328
used_memory_peak:3416888
used_memory_peak_human:3.26M
used_memory_lua:36864
mem_fragmentation_ratio:2.84
mem_allocator:jemalloc-3.6.0 # Persistence
loading:0
rdb_changes_since_last_save:0
rdb_bgsave_in_progress:0
rdb_last_save_time:1445092109
rdb_last_bgsave_status:ok
rdb_last_bgsave_time_sec:-1
rdb_current_bgsave_time_sec:-1
aof_enabled:0
aof_rewrite_in_progress:0
aof_rewrite_scheduled:0
aof_last_rewrite_time_sec:-1
aof_current_rewrite_time_sec:-1
aof_last_bgrewrite_status:ok
aof_last_write_status:ok # Stats
total_connections_received:2
total_commands_processed:2
instantaneous_ops_per_sec:0
total_net_input_bytes:42
total_net_output_bytes:3849
instantaneous_input_kbps:0.00
instantaneous_output_kbps:0.00
rejected_connections:0
sync_full:0
sync_partial_ok:0
sync_partial_err:0
expired_keys:0
evicted_keys:0
keyspace_hits:0
keyspace_misses:0
pubsub_channels:0
pubsub_patterns:0
latest_fork_usec:0
migrate_cached_sockets:0 # Replication
role:master
connected_slaves:0
master_repl_offset:0
repl_backlog_active:0
repl_backlog_size:1048576
repl_backlog_first_byte_offset:0
repl_backlog_histlen:0 # CPU
used_cpu_sys:0.02
used_cpu_user:0.06
used_cpu_sys_children:0.00
used_cpu_user_children:0.00 # Cluster
cluster_enabled:0 # Keyspace
127.0.0.1:26125>

环境配置完了。
遇到的问题:
出错信息:cc:未找到命令
解决办法:提示cc:未找到命令,原因是虚拟机系统中缺少gcc,安装一下gcc即可解决问题,下面看一下完整的安装过程。
yum -y install gcc automake autoconf libtool make
出错信息:In file included from adlist.c:34:0:
解决办法:make MALLOC=libc
转载自:http://www.cnblogs.com/ha666/p/4888330.html
centos下安装redis/mysql等基础环境的更多相关文章
- Centos下安装Redis
转自:http://nnzhp.cn/article/9/ 遇到问题,安装后并启动,redis-cli报错:Could not connect to Redis at 127.0.0.1:6379: ...
- (转载)——Centos下安装Redis(原文地址:http://www.nnzhp.cn/archives/169)
原文地址:http://www.nnzhp.cn/archives/169 今天介绍一下redis,重点介绍一下redis的安装. Redis 是一个基于内存的高性能key-value数据库,数据都保 ...
- CentOS下安装Redis及Redis的PHP扩展
1.安装Redis 1.1 如果没有安装wget,安装wget yum install wget 1.2 在http://redis.io/download页面查看redis版本,并下载安装 wget ...
- 在CentOS下安装配置MySQL(转)
今天刚把项目做完,需要马上部署到新到的测试服务器上,于是乎,要在服务器上安装环境,由于好久在linux上部署了,手有些生,比较费劲装完,现在把重要步骤贴出,供自己以后参照.1.首先要看看有没有已经安装 ...
- 【转载】Linux(CentOS)下安装Redis
转载地址:https://blog.csdn.net/diweikang/article/details/78784631 1.下载Redis下载最新Linux版本的Redis,我用的是redis-4 ...
- centos 下安装redis
一.安装redis 第一步:下载redis安装包 redis下载地址 wget http://download.redis.io/releases/redis-5.0.3.tar.gz 第二步:解压压 ...
- CentOS下安装Redis(转载)
Redis是一个高性能的,开源key-value型数据库.是构建高性能,可扩展的Web应用的完美解决方案,可以内存存储亦可持久化存储.因为要使用跨进程,跨服务级别的数据缓存,在对比多个方案后,决定使用 ...
- centos下安装redis(记录其中踩坑的过程)
一.先下载到redis-3.0.4.tar.gz包(本文以3.0.4版本为例) 我将这个包放在/opt目录下,在/opt下并解压这个包 tar -zxvf redis-.tar.gz 然后进入redi ...
- Linux centos 下安装redis
一.安装编译工具及库文件 yum -y install make zlib zlib-devel gcc-c++ libtool openssl openssl-devel 二.选择安装文件 ...
随机推荐
- 用html语言写一个功课表
今天在网上看了一个关于html的教程,主要是讲表格,看完之后认为有必要上机试试.于是就写了以下的一段代码. watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvb ...
- 关于有的Apk无法反编译的探究
Android的apk包,其实就是zip包,只不过后缀名换了而已!使用“好压”等解压缩工具解压,就可以看到里面的内容了.简单介绍一下吧. 以下就是解压出来的apk的内容: 其中: assets ...
- rest_framework (版本)
请求进来 封装request. 版本限制 认证 权限 节流 版本 self.version_param url中版本的key self.default_version self.is_allowed_ ...
- react --- 路由传参的几种方式
1.params 优势 : 刷新地址栏,参数依然存在缺点:只能传字符串,并且,如果传的值太多的话,url会变得长而丑陋. 2.query 优势:传参优雅,传递参数可传对象:缺点:刷新地址栏,参数丢失 ...
- birthday
2.29 7.25 7.... 5... 10.01 02 03
- Mojo Associated Interfaces
Mojo Associated Interfaces yzshen@chromium.org 02/22/2017 Background Before associated interfaces ar ...
- 列表的所有的input,将它的值以键值对的形式存放到一个数组里
要求的格式 代码块 $('.btn-confirm').on('tap',function(){ var arr={}; var name = $("input[name='insuranc ...
- 编译php并与nginx整合
告诉 Nginx 如何处理 php 文件: nginx>vim conf/nginx.conf location ~ \.php${ ...
- Windows下使用VS的ADO访问MySQL
数据库的访问的一种方式就是:CS结构.即使用TCP/UDP协议进行远程访问,而数据库对于服务端的软件是本地访问!这种管理方式比较常见. 这里主要叙述Windows访问本地数据库的方法. 需要了解几个概 ...
- Linux学习-Ubuntu 18.04-安装图文教程
Ubuntu(友帮拓.优般图.乌班图)是一个以桌面应用为主的开源GNU/Linux操作系统,Ubuntu 是基于Debian GNU/Linux,支持x86.amd64(即x64)和ppc架构,由全球 ...