zoukankan      html  css  js  c++  java
  • CentOS On VirtualBox

    背景

    后台开发需要随时与服务器交互,本人使用Mac开发。但是不愿意在Mac上直接安装redis以及mysql等等工具。所以选择在VirtualenvBox下安装一个服务器系统,并且使用ssh与其连接。为方便日后环境重现,记录下安装配置过程。本文介绍开发人员必备的常见工具及数据库。

    开始

    1,下载镜像,这里我选择CentOS版本。
    2,安装系统。
    3,配置超级用户权限

    vi /etc/sudoers
    

    增加如下信息

    frank  ALL=(ALL)   ALL
    

    4,配置网络。

    cd /etc/sysconfig/network-scripts
    vi ifcfg-enp0s3
    

    然后是把ONBOOT=no修改为ONBOOT=yes
    5,配置yum

    安装工具

    1,安装VIM

    sudo yum install vim
    

    2,安装[netstat]

    yum install net-tools
    

    3,安装SSH

    sudo yum install openssh-server
    

    配置ssh

    vim /etc/ssh/sshd_config
    

    修改以下几项为。

    Port 22
    AddressFamily any
    

    然后是修改/etc/hosts.allow/etc/hosts.deny
    分别在最后文件的最后一行添加如下语句

    sshd:ALL
    

    重启sshd服务

    systemctl restart sshd.service
    

    新的centOS系统已经不再使用service xxxx restart命令了。
    测试sshd服务是否已经启用。

    netstat -ltnp
    

    随机启动可以通过如下命令。

    systemctl enable sshd.service
    

    4,安装[wget]

    yum install wget
    

    5,安装[nc]

    yum install nc
    

    6,安装[gcc]

    yum install gcc
    

    7,安装[g++]

    sudo yum install gcc-c++
    

    8,安装[tmux]

    yum install tmux
    

    9,安装[bzip2]

    sudo yum install bzip2
    

    安装Python

    1,安装[python]

    sudo yum -y install python-devel
    sudo yum -y install python-setuptools
    

    2,安装[pip]

    curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py"
    sudo python get-pip.py
    

    3,安装[virtualenv]

    sudo pip install virtualenv
    

    4,安装[supervisor]

    sudo pip install supervisor
    

    启动

    echo_supervisord_conf > /etc/supervisord.conf
    supervisord
    

    运行客户端测试服务

    supervisorctl 
    

    安装VirtualBox扩展

    sudo mount -t auto /dev/cdrom /mnt/
    sudo sh ./VBoxLinuxAddition.run
    

    依赖源

    如果安装redis或者nginx等,出现如下错误

    [root@localhost frank]# yum -y install redis
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * base: mirror.bit.edu.cn
     * extras: mirror.bit.edu.cn
     * updates: mirror.bit.edu.cn
    No package redis available.
    

    上面的错误提示都可以通过下面的方式解决。

    wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
    rpm -ivh epel-release-6-8.noarch.rpm
    

    安装数据库

    1,安装Redis

    sudo yum -y install redis
    

    安装成功后可以通过下面的命令启动。

    systemctl start redis.service
    

    随机启动可以通过如下命令。

    systemctl enable redis.service
    

    2,安装MySQL

    wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
    sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm
    sudo yum install mysql-server
    

    启动

    systemctl restart mysql.service
    

    root用户设置密码

    mysql -u root
    mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpass');
    

    3,安装MongoDB

    新建如下文件。

    vi /etc/yum.repos.d/mongodb.repo
    

    添加如下代码。

    [mongodb]
    name=MongoDB Repository
    baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/
    gpgcheck=0
    enabled=1
    

    开始安装

    sudo yum install mongodb-org
    

    启动

    systemctl start mongod.service
    

    MongoDB参考

    4,安装Nginx

    wget http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
    sudo rpm -ivh nginx-release-centos-7-0.el7.ngx.noarch.rpm
    sudo yum install nginx
    

    安装消息队列

    1,安装ZeroMQ

    sudo yum install zeromq
    
    

    2,安装[RabbitMQ]

    rpm --import https://www.rabbitmq.com/rabbitmq-release-signing-key.asc
    yum install rabbitmq-server
    systemctl start rabbitmq-server
    systemctl enable rabbitmq-server
    
  • 相关阅读:
    0.0
    《用户故事与敏捷方法》 笔记
    Linux下运行Jmeter压测
    64位Win7系统安装Mysql 5.7.22图文教程
    Zabbix-(七)分布式监控
    Zabbix-(六) JMX监控
    Zabbix-(五)监控Docker容器与自定义jvm监控项
    Zabbix-(四)邮件、钉钉告警通知
    Zabbix-(三)监控主机CPU、磁盘、内存并创建监控图形
    Zabbix-(二) 使用docker部署
  • 原文地址:https://www.cnblogs.com/landpack/p/6029377.html
Copyright © 2011-2022 走看看