hello cc

centos 7常用需求

Posted on 2017-02-28 14:00  星际海盗  阅读(315)  评论(0编辑  收藏  举报

1. 安装locate工具  yum install mlocate

 

2. 安装netstat 和 ifconfig    yum install net-tools

 

3. web server     yum -y install httpd

  配置/etc/httpd/conf/httpd.conf 后ok。。。

  详细参照  http://www.linuxidc.com/Linux/2015-02/113921.htm

        http://www.centoscn.com/CentosServer/www/2015/0730/5944.html

        http://www.linuxidc.com/Linux/2014-11/109235.htm

 

  nginx

  (1)使用yum安装nginx需要包括Nginx的库,安装Nginx的库

  #rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

  (2)使用下面命令安装nginx

  #yum install nginx

  (3)启动Nginx

  #service nginx start

  firewall开启80端口

  firewall-cmd --zone=public --add-port=80/tcp --permanent

  systemctl restart firewalld.service

 

 

4.安装golang

yum install golang

 注:7可以直接安装golang,低版本需要配置源。

 

5.mysql

centos7 mysql数据库安装和配置

yum install mariadb-server mariadb

systemctl start/stop/restart mariadb  启动后服务名还是mysql,

注:这里配置mysql的一个分支版本mariadb,考虑开源问题,CentOS 7 版本已将MySQL数据库软件从默认的程序列表中移除,

用mariadb代替了,MariaDB 是一个采用Aria存储引擎的MySQL分支版本,

是由原来 MySQL 的作者Michael Widenius创办的公司所开发的免费开源的数据库服务器,

MariaDB不仅仅是Mysql的一个替代品,它的主要目的是创新和提高Mysql的技术

more:http://www.cnblogs.com/starof/p/4680083.html

优化进入:/usr/share/mysql目录下修改cnf文件。

 

6.tomcat 

tomcat  jdk搭建:CentOS中安装jdk和tomcat,并配置环境变量

  http://blog.csdn.net/tantexian/article/details/50507463

  http://blog.csdn.net/irhythm/article/details/52399575

注:修改tomcat账户权限以及访问ip:参照  http://blog.csdn.net/guochunyang/article/details/51820066

修改配置文件:

Tomcat/conf/tomcat-users.xml

Tomcat/webapps/manager/META-INF/context.xml

启动:

在解压路径下:/opt/tomcat90/bin 

startup.sh

shutdown.sh

或将其添加为开机启动。

 

7 安装PHP以及PHP拓展

yum install php php-mysql php-gd libjpeg* php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-bcmath php-mhash
systemctl restart httpd.service

编辑一个 /var/www/html/index.php  查看效果。

 8.一键vpn

wget https://git.io/vpnsetup-centos -O vpnsetup.sh && sudo sh vpnsetup.sh

源自:https://github.com/hwdsl2/setup-ipsec-vpn/blob/master/README-zh.md

 

 

二:问题

 1.  service iptables stop 显示not loaded

  centos从7开始默认用的是firewalld,这个是基于iptables的,虽然有iptables的核心,但是iptables的服务是没安装的。所以你只要停止firewalld服务即可: 

  sudo systemctl stop firewalld.service && sudo systemctl disable firewalld.service

  如果你要改用iptables的话,需要安装iptables服务: 
  sudo yum install iptables-services 
  sudo systemctl enable iptables && sudo systemctl enable ip6tables 
  sudo systemctl start iptables && sudo systemctl start ip6tables

 

iptables相关:

http://www.cnblogs.com/kreo/p/4368811.html

 

 2. CentOS──xxx is not in the sudoers file    

  http://blog.163.com/viewsoft@yeah/blog/static/169127244201382410483079/

 

 3.centOS下tar: bzip2: Cannot exec: No such file or directory

  用tar 解压 tar.bz2文件出错

  解决办法

  安装bzip2软件包  apt-get install bzip2  or  yum install bzip2

 

 4.把网卡名称修改为eth0的方法

  http://www.wuji8.com/meta/48268454.html   测试成功

  起因是网卡ip无法设置静态,看着就别扭,直接换名,

 

 5. 字符界面和图形界面切换:

  命令模式
    systemctl set-default multi-user.target

  图形模式
    systemctl set-default graphical.target

    6. GPG key retrieval failed: [Errno 14] curl#37 - "Couldn't open file /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7"

  解决办法:https://www.bonusbits.com/wiki/HowTo:Install_EPEL_Repository_on_CentOS

  centos7 :   rpm --import http://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7

 

  

三:

yum -y install ruby
sudo yum install xorg-x11-server-Xvfb
可手动下载  https://gist.github.com/appastair/3913714
这个是32 位的 wget http://downloads.metasploit.com/data/releases/metasploit-latest-linux-installer.run
wget http://downloads.metasploit.com/data/releases/metasploit-latest-linux-x64-installer.run
chmod +x metasploit-latest-linux-x64-installer.run

sudo ./metasploit-latest-linux-x64-installer.run

 

hello man