• lamp


    先给虚拟机拍个照哦,弄错了,恢复到拍照的地方
    1、配置防火墙
    CentOS 7.0默认使用的是firewall作为防火墙。
    (1)、关闭firewall:
    systemctl stop firewalld.service #停止firewall  
    systemctl disable firewalld.service #禁止firewall开机启动 
     
    (2)、关闭SELINUX
    vi /etc/selinux/config
      
    #SELINUX=enforcing #注释掉 
     
    SELINUX=disabled #增加 
     
    :wq! #保存退出  
    setenforce 0 #使配置立即生效 
    2.安装apache
    yum install httpd #根据提示,输入Y安装即可成功安装  
    y
     #启动apache 
     
    systemctl stop httpd.service #停止apache  
    systemctl restart httpd.service #重启apache  
    systemctl enable httpd.service #设置apache开机启动 
    3.CentOS7下安装MySQL5.7安装与配置(YUM)
    (1)下载mysql源安装包
    shell> wget http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm
      
    (2)安装mysql源
    shell> yum localinstall mysql57-community-release-el7-7.noarch.rpm
    (3)检查mysql源是否安装成功
    shell> yum repolist enabled | grep "mysql.*-community.*"
    (4)、安装MySQL
    shell> yum install mysql-community-server
    (5)、启动MySQL服务
    shell> systemctl start mysqld
    (6)查看MySQL的启动状态
    shell> systemctl status mysqld
    ● mysqld.service - MySQL Server
      Loaded: loaded (/usr/lib/systemd/system/mysqld.service; disabled; vendor preset: disabled)
      Active: active (running) since 五 2016-06-24 04:37:37 CST; 35min ago
    Main PID: 2888 (mysqld)
      CGroup: /system.slice/mysqld.service
      └─2888 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid
    6月 24 04:37:36 localhost.localdomain systemd[1]: Starting MySQL Server...
    6月 24 04:37:37 localhost.localdomain systemd[1]: Started MySQL Server.
    (7)、开机启动
    shell> systemctl enable mysqld
    shell> systemctl daemon-reload
    (8)、修改root默认密码VfbfjwIZ>2,
    mysql安装完成之后,在/var/log/mysqld.log文件中给root生成了一个默认密码。通过下面的方式找到root默认密码,然后登录mysql进行修改:
    shell> grep 'temporary password' /var/log/mysqld.log
    shell> mysql -uroot -p
    mysql> set password for 'root'@'localhost'=password('MyNewPass4!'); 
    注意:mysql5.7默认安装了密码安全检查插件(validate_password),默认密码检查策略要求密码必须包含:大小写字母、数字和特殊符号,并且长度不能少于
    8位。否则会提示ERROR 1819 (HY000): Your password does not satisfy the current policy requirements错误,如下图所示: 
    通过msyql环境变量可以查看密码策略的相关信息:
    mysql> show variables like '%password%';
    重新启动mysql服务使配置生效:
    systemctl restart mysqld
    (9)、添加远程登录用户
    默认只允许root帐户在本地登录,如果要在其它机器上连接mysql,必须修改root允许远程连接,或者添加一个允许远程连接的帐户,为了安全起见,我添加一个
    新的帐户:
    mysql> GRANT ALL PRIVILEGES ON *.* TO 'yangxin'@'%' IDENTIFIED BY 'Yangxin0917!' WITH GRANT OPTION;
    (10)、配置默认编码为utf8
    修改/etc/my.cnf配置文件,在[mysqld]下添加编码配置,如下所示:
    vi /etc/my.cnf
    [mysqld]
    character_set_server=utf8
    init_connect='SET NAMES utf8'
    sql_mode=NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
    重新启动mysql服务,查看数据库默认编码如下所示
    systemctl restart mysqld
    mysql> show variables like 'character_set_database';
    默认配置文件路径:  
    配置文件:/etc/my.cnf  
    日志文件:/var/log//var/log/mysqld.log  
    服务启动脚本:/usr/lib/systemd/system/mysqld.service  
    socket文件:/var/run/mysqld/mysqld.pid
    4、Centos7 安装 PHP7最新版的详细教程
    简单安装(通过yum)
            yum -y install epel-release(命令安装)
            手动安装
    (1).安装epel-release(***********此处可能会有无法解析主机,跳转。。。。******************注意要改成桥接网络)
    rpm -ivh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-10.noarch.rpm
                    rpm -ivh http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm
    (2).安装PHP7的rpm源
    rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
    (3).安装PHP7
    yum install php70w
    (4).安装php配置
    yum install php70w.x86_64 php70w-cli.x86_64 php70w-common.x86_64 php70w-gd.x86_64 php70w-ldap.x86_64 php70w-mbstring.x86_64 php70w-
    mcrypt.x86_64 php70w-mysql.x86_64 php70w-pdo.x86_64
    systemctl restart mysqld #重启Mysql
    systemctl restart httpd.service #重启apache  
    测试
    cd /var/www/html
    vi index.php #输入下面内容
    <?php
    phpinfo();
    ?>
    :wq! #保存退出
    在客户端浏览器输入服务器IP地址,可以看到如下图所示相关的配置信息!
    事件起因:
    在安装ansible过程中,因为系统的yum仓库默认没有ansible的包,所以下载安装了epel源,安装完成后
    用yum安装报错如下:
    yum install ansible -y
    Loaded plugins: priorities, update-motd, upgrade-helper
    amzn-main/latest                                            | 2.1 kB     00:00     
    amzn-updates/latest                                         | 2.3 kB     00:00     
    epel/x86_64                                                 | 4.3 kB     00:00     
    Could not retrieve mirrorlist http://apt.sw.be/redhat/el5/en/mirrors-rpmforge error was
    14: PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    Trying other mirror.
     One of the configured repositories failed (RHEL latest - RPMforge.net - dag),
     and yum doesn't have enough cached data to continue. At this point the only
     safe thing yum can do is fail. There are a few ways to work "fix" this:
         1. Contact the upstream for the repository and get them to fix the problem.
         2. Reconfigure the baseurl/etc. for the repository, to point to a working
            upstream. This is most often useful if you are using a newer
            distribution release than is supported by the repository (and the
            packages for the previous distribution release still work).
         3. Disable the repository, so yum won't use it by default. Yum will then
            just ignore the repository until you permanently enable it again or use
            --enablerepo for temporary usage:
                yum-config-manager --disable rpmforge
         4. Configure the failing repository to be skipped, if it is unavailable.
            Note that yum will try to contact the repo. when it runs most commands,
            so will have to try and fail each time (and thus. yum will be be much
            slower). If it is a very temporary problem though, this is often a nice
            compromise:
                yum-config-manager --save --setopt=rpmforge.skip_if_unavailable=true
    failure: repodata/repomd.xml from rpmforge: [Errno 256] No more mirrors to try.
    解决方法:
    执行第三步和第四步中的命令:
    yum-config-manager --disable rpmforge
    yum-config-manager --save --setopt=rpmforge.skip_if_unavailable=true
    然后再重试
    yum install ansible -y
    安装成功,没有再报错
    本文出自 “小五台车神” 博客,请务必保留此出处http://linuxtech.blog.51cto.com/3670088/1842106
  • 相关阅读:
    linux可执行文件添加到PATH环境变量的方法
    PHPExcel所遇到问题的知识点总结
    如何查看已经安装的nginx、apache、mysql和php的编译参数
    oracle 创建用户及表空间命令
    datetimepicker 设置日期格式、初始化
    Linux 修改系统时间(自动同步)
    Nginx 负载均衡配置
    CenterOS7 安装 Nginx【转】
    java https post请求并忽略证书,参数放在body中
    将.cer证书导入java密钥库?
  • 原文地址:https://www.cnblogs.com/huangfuqiang/p/7874471.html
Copyright © 2020-2023  润新知