下面是我经常用到Centos系统工具包和命令,特别是防火墙,很多程序会被防火墙拦截和SELINUX屏蔽
一、配置防火墙,开启80端口、3306端口
CentOS 7.0默认使用的是firewall作为防火墙systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
二、关闭SELINUX
vi /etc/selinux/config
#SELINUX=enforcing #注释掉
#SELINUXTYPE=targeted #注释掉
SELINUX=disabled #增加
:wq! #保存退出
setenforce 0 #使配置立即生效
三、安装Apache
yum install httpd #根据提示,输入Y安装即可成功安装
systemctl start httpd.service #启动apache
systemctl stop httpd.service #停止apache
systemctl restart httpd.service #重启apache
systemctl enable httpd.service #设置apache开机启动
在客户端浏览器中打开服务器IP地址,会出现下面的界面,说明apache安装成功
vi /etc/httpd/conf/httpd.conf #编辑文件
四、安装PHP
yum install php #根据提示输入Y直到安装完成
yum install php-mysql php-gd libjpeg* php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-bcmath php-mhash
#这里选择以上安装包进行安装,根据提示输入Y回车
systemctl restart mariadb.service #重启MariaDB
systemctl restart httpd.service #重启apache
五、安装ssh2扩展
第一、安装支持库文件
yum install php-devel php-pear libssh2 libssh2-devel -y
直接登录SSH客户端,然后执行命令回车,安装需要的库文件。
第二、安装SSH2扩展
pecl install -f ssh2
执行命令,然后看到一个输入界面,直接回车。
第三、修改ssh2.ini
touch /etc/php.d/ssh2.ini
echo extension=ssh2.so > /etc/php.d/ssh2.ini
添加文件进去。
第四、检查SSH2是否安装成功
php -m | grep ssh2
php -i|grep ssh2
六、samba 配置(先执行一,二)
1、使用yum -y install samba samba-client samba-common安装Samba
2、查看Samba版本信息rpm -qi samba
vi /etc/samba/smb.conf
创建SAMBA用户
操作格式:命令+用户名
例如:# smbpasswd -a lxl
# systemctl restart smb
# systemctl enable smb
# systemctl status smb
七、查看包是否安装和卸载程序
rpm -qa subversion
yum remove subversion
八、固定ip设置,查看ip命令
查看ip不是使用ifconfig,而是用ip addr
PEERDNS yes 每次重新/etc/resolv.confONBOOT=yes
BOOTPROTO=static/dhcp
IPADDR=10.123.15.89
NETMASK=255.255.255.0
GATEWAY=10.123.15.2
DNS1=10.123.15.2
九、CentOS安装TortoiseSVN
需重新安装最新版本
configure: error: APR not found . Please read the documentation
解决办法:
1.下载所需软件包:
wget http://archive.apache.org/dist/apr/apr-1.4.5.tar.gz
./configure –prefix=/usr/local/apr
wget http://archive.apache.org/dist/apr/apr-util-1.3.12.tar.gz
./configure –prefix=/usr/local/web/apr-util –with-apr=/usr/local/apr
wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.10/pcre-8.10.zip