centos 自带apache(httpd)不用安装

1.查看linux 版本号

方法1:

cat /etc/redhat-release
/etc/redhat-release配置文件用一行内容来声明 Red Hat 的名称和版本号。 由 rc.local 使用.
方法2:查看rpm包版本
rpm -q centos-release

如果是redhat,用这个 rpm -q redhat-release

方法3:linux 通用 但是如果没有lsb_release 命令还需要安装

yum  install   lsb_release  -y

然后查看

lsb_release -a

方法4:

uname  -r   / uname -a

2.设置ssh

我的虚拟机安装完成后,使用ssh命令提示ssh:command not  found

解决方法是:

yum install   openssh*

开启关闭ssh

service sshd restart    或    /etc/init.d/sshd  restart
service sshd stop
SSH开启后会有一个进程SSHD在运行,可以用netstat -nap 命令查询得到
netstat -nap | grep -i sshd

查看ssh端口

netstat -a | grep ssh 或 ps -ef | grep ssh 

3.设置网卡

将网卡设为开机默认启动

vi  /etc/sysconfig/network-scripts/ifcfg=eth0

将里面的onboot 设为yes

启动网卡

/etc/init.d/network  restart   或者   service  network  restart

查看ip地址

ifconfig

如图:

ping 一下 看网卡是否正常

ping  www.baidu.com
有时候eth0不出现,或者没有ip地址 ,设置虚拟机网络为nat或者桥接且选中接入网线cable connected,然后再命令行中 dhclient eth0,一般就可以了

4.yum更新所有软件
yum  update

5.yum安装nginx

直接安装不了,需要先处理下源

rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm

然后通过yam安装

yum  install  nginx
6.设置虚拟机网站可以被本机访问
状况如下:本机可以ping通虚拟机,虚拟机也能ping通本机,虚拟机能访问自己的web,本机无法访问虚拟己的web。
原因是防火墙将80端口屏蔽了
解决办法:
/sbin/iptables -I INPUT -p tcp --dport  -j ACCEPT

保存

/etc/rc.d/init.d/iptables save

重启防火墙

/etc/init.d/iptables restart

查看防火墙状态

/etc/init.d/iptables status

7.修改linux的名字

vim /etc/sysconfig/network

NETWORKING=yes
HOSTNAME=localhost.localdomain

改成

NETWORKING=yes
HOSTNAME=namenew

然后

vim   /etc/hosts   

添加

127.0.0.1    namenew

命令行  输入

hostname   namenew 

后关闭命令行重新进入就改完了

centos linux的更多相关文章

  1. CentOS Linux服务器安全设置

    转自:http://www.osyunwei.com/archives/754.html 引言: 我们必须明白:最小的权限+最少的服务=最大的安全 所以,无论是配置任何服务器,我们都必须把不用的服务关 ...

  2. CentOS Linux解决Device eth0 does not seem to be present

    在VMware里克隆出来的Centos Linux.. ifconfig...没有看到eth0..然后重启网卡又报下面错误. 故障现象: 解决办法: 首先,打开/etc/udev/rules.d/70 ...

  3. CentOS linux下安装和配置Apache+SVN(用浏览器http方式访问SVN目录)

    在CentOS linux下安装SVN,我们可以进行以下步骤: 第一步:安装CentOS Linux操作系统,并在CentOS安装进行的同时,自定义安装这一步,一定要勾选Subversion(在“开发 ...

  4. Centos7安装完毕后重启提示Initial setup of CentOS Linux 7 (core)的解决方法

    问题: CentOS7安装完毕,重新开机启动后显示: Initial setup of CentOS Linux 7 (core) 1) [x] Creat user 2) [!] License i ...

  5. CentOS Linux VPS安装IPSec+L2TP VPN

    CentOS Linux VPS安装IPSec+L2TP VPN 时间 -- :: 天使羊波波闪耀光芒 相似文章 () 原文 http://www.live-in.org/archives/818.h ...

  6. [转]装完CentOS后,重新开机启动后显示: Initial setup of CentOS Linux 7 (core)

    转:装完Centos7提示Initial setup of CentOS Linux 7 (core)   在用U盘装完CentOS后,重新开机启动后显示: Initial setup of Cent ...

  7. centos linux安全和调优 第四十一节课

    centos  linux安全和调优    第四十一节课 上半节课 Linux安全 下半节课 Linux调优 2015-07-01linux安全和调优 [复制链接]--http://www.apele ...

  8. 转:装完Centos7提示Initial setup of CentOS Linux 7 (core)

    在用U盘装完CentOS后,重新开机启动后显示: Initial setup of CentOS Linux 7 (core) 1) [x] Creat user 2) [!] License inf ...

  9. Centos linux php扩展安装步骤

    使用phpinfo()函数输出PHP信息,然后找到Configuration File (php.ini) apachectl 其设计意图是帮助管理员控制Apache httpd后台守护进程的功能. ...

  10. VMware ESXi CentOS Linux虚拟机安装VMware Tools教

    转自VMware ESXi CentOS Linux虚拟机安装VMware Tools教程 | 一米居 http://www.yimiju.com/articles/548.html 最近一周在学习和 ...

随机推荐

  1. [leetCode][003] Intersection of Two Linked Lists

    [题目]: Write a program to find the node at which the intersection of two singly linked lists begins. ...

  2. Java_解决java.security.cert.CertificateException: Certificates does not conform to algorithm constraints

    找到 jre/lib/security/java.security 将 jdk.certpath.disabledAlgorithms=MD2, DSA, RSA keySize < 2048 ...

  3. C#关闭word进程

    C#关闭word进程 foreach (System.Diagnostics.Process p in System.Diagnostics.Process.GetProcessesByName(&q ...

  4. C++ Ouput Exactly 2 Digits After Decimal Point 小数点后保留三位数字

    在C++编程中,有时候要求我们把数据保留小数点后几位,或是保留多少位有效数字等等,那么就要用到setiosflags和setprecision函数,记得要包含头文件#include <ioman ...

  5. Odoo Auto Backup Database And Set Linux task schedualer

    First ,Write Database Backup Script: pg_dump -Fc yourdatabasename > /home/yourfilepath/yourdataba ...

  6. hdu Waiting ten thousand years for Love

    被这道题坑到了,如果单纯的模拟题目所给的步骤,就会出现同一个位置要走两次的情况...所以对于bfs来说会很头痛. 第一个代码是wa掉的代码,经过调试才知道这个wa的有点惨,因为前面的操作有可能会阻止后 ...

  7. javascript中的function

    function / 对象 所有的变量和方法名的:以字母,$ _开头其他随便,尽量使用英文字母命名,见名知意注意点:不允许使用关键字定义变量和方法的名称====函数即方法,方法即函数====百度:ja ...

  8. php如何把文件上传到服务器上

    conn.php: <?php $id=mysql_connect('localhost','root','root'); mysql_select_db("db_database12 ...

  9. app.config中的connectionstring

    <connectionStrings>    <add name="wz" connectionString="server=www.junjv.com ...

  10. 将服务器上的某些特定日志统一保存至XPS文件

    <APACHost.CSV> Hostname,IP,OSType srv1,10.103.22.22,Win2003 srv2,10.103.22.37,Win2008   Import ...