【服务器】物理服务器从零搭建

装系统

安装Centos7:https://www.cnblogs.com/blakflash000/p/9816213.html

开网络

  • 启动网卡
    cd /etc/sysconfig/network-scripts
    vi ifcfg-em3

  • 设置静态IP
    修改ifcfg-em2文件的内容:

     #设置网卡获得ip地址的方式,选项可以为static,dhcp或bootp
    BOOTPROTO=static
    #设置静态IP
    IPADDR=***.***.***.*** 
    #系统启动时是否设置此网络接口,设置为yes时,系统启动时激活此设备
    ONBOOT=yes 
  • 重启网卡
    systemctl restart network

装环境

安装LAMP环境

  • 安装Apache HTTP服务器
 yum –y install httpd
#完成后开启httpd服务,并且让其在重启系统时自启动。
systemctl start httpd.service
systemctl enable httpd.service
#接着配置防火墙允许服务器被外部访问
 firewall-cmd --permanent --add-service=http
 firewall-cmd –reload
 systemctl restart httpd.service
  • 安装PHP
yum –y install php
systemctl restart httpd.service
  • 安装数据库
    MariaDB数据库管理系统是MySQL的一个分支
yum –y install mariadb-server mariadb
systemctl start mariadb.service
systemctl enable mariadb.service
 #允许MariaDB被远程访问
firewall-cmd --add-service=mysql     

#设置数据库密码
 mysqladmin -u root password "密码"
  • 安装phpMyAdmin
    phpMyAdmin让管理者可用Web接口管理MySQL数据库
yum install epel-release
rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
yum install phpmyadmin

使用外网访问

这个需要操作路由器,使用NAT映射


版权声明:本文为GO_D_OG原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。