Day11 Memcached、Redis和RabbitMQ安装

修改Ubuntu镜像源:
sudo vi /etc/apt/sources.list
全部替换为以下内容:
------------------------------------------------------------------------------------------------
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse
------------------------------------------------------------------------------------------------
sudo apt-get update && sudo apt-get dist-upgrade

1、安装memcached需要先安装libevent
./configure --prefix=/apps/python/libevent
make
make install

2、安装memcached
./configure --prefix=/apps/python/memcached --with-libevent=/apps/python/libevent
make
make install

3、配置环境变量
vi /home/scm/.profile
export MEMCACHED_HOME=/apps/pythonmemcached
PATH=\({MEMCACHED_HOME}/bin:\)PATH
source /home/scm/.profile

4、启动memcached
memcached -d -m 10 -u root -l 192.168.195.128 -p 12000 -c 256 -P /tmp/memcached.pid

5、安装redis
sudo make PREFIX=/apps/python/redis install
sudo make test

6、配置环境变量
vi /home/scm/.profile
export REDIS_HOME=/apps/python/redis
PATH=\({REDIS_HOME}/bin:\)PATH
source /home/scm/.profile

启动redis:
redis-server --protected-mode no &
7、安装RabbitMQ
sudo apt-get update
sudo apt-get upgrade
cd /tmp/
安装erlang:
wget http://packages.erlang-solutions.com/ubuntu/erlang_solutions.asc
sudo apt-key add erlang_solutions.asc
sudo apt-get update
sudo apt-get install erlang
sudo apt-get install erlang-nox
安装RabbitMQ:
sudo subl /etc/apt/sources.list
在文件最后添加一行:
deb http://www.rabbitmq.com/debian/ testing main
添加密钥
cd /tmp
wget https://www.rabbitmq.com/rabbitmq-signing-key-public.asc
sudo apt-key add rabbitmq-signing-key-public.asc
sudo apt-get update
sudo apt-get install rabbitmq-server

启动RabbitMQ服务
sudo systemctl enable rabbitmq-server
sudo systemctl start rabbitmq-server
查看RabbitMQ服务
sudo systemctl status rabbitmq-server

启动RabbitMQ-Management插件
sudo rabbitmq-plugins enable rabbitmq_management
重启RabbitMQ
sudo systemctl restart rabbitmq-server

增加用户和密码
sudo rabbitmqctl add_user radar 12345678
查看已存在的用户
sudo rabbitmqctl list_users
修改用户密码
sudo rabbitmqctl change_password guest 12345678

8、Windows下安装RabbitMQ
安装ERLANG:
下载地址:http://www.erlang.org/downloads
配置环境变量
ERLANG_HOME=C:\Program Files\erl8.0
Path=%ERLANG_HOME%\bin
安装RabbitMQ:
下载地址:http://www.rabbitmq.com/download.html
配置环境变量
RABBIT_HOME=C:\Program Files\RabbitMQ Server\rabbitmq_server-3.6.5
Path=%RABBIT_HOME%\sbin
以管理员身份打开cmd,进入C:\Program Files\RabbitMQ Server\rabbitmq_server-3.6.5目录
执行rabbitmq-plugins.bat enable rabbitmq_management
rabbitmq-service.bat
rabbitmq-service.bat stop
rabbitmq-service.bat install
rabbitmq-service.bat start
浏览器访问:http://localhost:15672

9、Windows下安装MySQL-5.7.14
将mysql-5.7.14-winx64.zip解压并重命名为MySQL,同时拷贝至“C:\Program Files”目录下
配置环境变量:
MYSQL_HOME=C:\Program Files\MySQL
Path = %MYSQL_HOME%\bin;
在MySQL目录下新建data目录,修改my-default.ini文件

These are commonly set, remove the # and set as required.

basedir = C:\Program Files\MySQL
datadir = C:\Program Files\MySQL\data
port = 3306

server_id = .....

cd C:\Program Files\MySQL\bin
mysqld install MySQL --defaults-file="C:\Program Files\MySQL\my-default.ini"
mysqld --initialize --user=Administrator --console
请记住“localhost:”后的密码如:Bb)wGUoFr7e;
若需要重置,请先删除data目录后再次运行该命令
已管理员身份启动服务:net start mysql
登录MySQL
mysql -u root
mysql>set Password = password('123456');
mysql>flush privileges;
mysql>exit;

10、CentOS7下源码安装MySQL
首先安装 yum install -y ncurses-devel bison
tar zxvf ncurses-6.0.tar.gz
cd ncurses-6.0
./configure --prefix=/usr/local/ncurses --with-shared --without-debug --without-ada --enable-overwrite
make
make install

mkdir -p /usr/local/mysql
mkdir -p /usr/localmysql/db/data
tar zxvf mysql-5.6.14.tar.gz
cd mysql-5.6.14
cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DMYSQL_DATADIR=/usr/local/mysql/db/data \
-DMYSQL_USER=root \
-DMYSQL_TCP_PORT=3306
make
make install
vi /etc/profile
export MYSQL_HOME=/usr/local/mysql
export PATH=\({MYSQL_HOME}/bin:\)PATH
source /etc/profile

cd /usr/local/mysql
/scripts/mysql_install_db --user=svn --datadir=/usr/local/mysql/db/data
su - root
mv /etc/my.cnf /etc/my.cnf.bak
su - svn
/usr/local/mysql/support-files/mysql.server start
mysql -u root
mysql>use mysql;
mysql>GRANT ALL PRIVILEGES ON . TO root@"%" IDENTIFIED BY "root";
mysql>update user set Password = password('123456') where User='root';
mysql>flush privileges;
mysql>exit;

上一篇:用事实说话,成熟的ORM性能不是瓶颈,灵活性不是问题:EF5.0、PDF.NET5.0、Dapper原理分析与测试手记


下一篇:rabbitmq安装Management Plugin