Posts Tagged ‘Linux’

CentOS 7 开放防火墙端口命令

星期一, 4月 29th, 2019

关闭防火墙
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动

开启端口
firewall-cmd --zone=public --add-port=80/tcp --permanent

命令含义:
--zone #作用域
--add-port=80/tcp #添加端口,格式为:端口/通讯协议
--permanent #永久生效,没有此参数重启后失效

(更多…)

CentOS 7_64升内核及部署Shadowsocks

星期四, 1月 31st, 2019

1. How to Install or Upgrade to Kernel 4.20 in CentOS 7
来源: https://www.tecmint.com/install-upgrade-kernel-version-in-centos-7/ ,逐行复制到命令行执行,共9行:

uname -sr
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm
yum --disablerepo="*" --enablerepo="elrepo-kernel" list available
yum --enablerepo=elrepo-kernel install kernel-ml -y
sed -i 's/GRUB_DEFAULT=saved/GRUB_DEFAULT=0/g' /etc/default/grub
grub2-mkconfig -o /boot/grub2/grub.cfg
reboot
uname -sr

(更多…)

CentOS 6更新时区和时间

星期一, 9月 10th, 2018

date -R #查看当前时间和时区

cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime #修改成东八区:北京时间

yum install ntp #安装ntpd和ntpdate服务

ntpdate time.windows.com #连网同步时间

hwclock -w #将系统时间写入BIOS,可选,有些VPS可能不支持

rpm -qa | grep ntp #查询是否安装了ntp相关的服务

chkconfig --list | grep ntp #看下服务情况

chkconfig ntpd on #开启更新时间服务

在树莓派中部署Nginx+PHP的方法

星期四, 1月 14th, 2016

参考来源:点这里

1. 安装

sudo apt-get update
sudo apt-get install nginx
sudo service nginx start
sudo apt-get install php5-fpm php-apc
sudo service php5-fpm restart

2. 部署
(更多…)

VM虚拟机安装CentOS

星期二, 7月 7th, 2015

所使用的VPS全是安装的CentOS系统,32位、64位的都用过,相对来说比其它Linux系统熟悉一些,今天才想起来是不是在VMware虚拟机上也可以装一个来玩玩。

网上搜了一下,说确实可以,然后在这里找到CentOS 6.4的ISO下载,因为最近主要用64位,所以想下载一个64位的CentOS来安装,发现竟然要4.1G,最后下了个64位迷你版来安装,只有350M左右。

在VMware里按平时安装XP、Win7的方式完成安装,选的NAT网卡方式,发现默认竟然没有分配IP地址,在这里找到线索,我只把/etc/sysconfig/network-scripts/ifcfg-eth0的ONBOOT改成yes,然后执行“service network restart”自动分配到IP地址了,暂时不理解这些参数的含义。

然后就可以正式玩CentOS系统了:
yum -y install yum-fastestmirror
yum -y update
yum -y install vim-enhanced
yum -y install zip unzip

树莓派Raspbmc上开启cron

星期二, 12月 2nd, 2014

最近Raspbmc好像自动升级了,导致部署的Transmission PT下载时不时的终止,为了解决这个问题,我们想到的是通过计划任务定时检查服务,如果服务不存在自动启动服务。

默认情况下Raspbmc是没有开启cron的,这里找到开通方法:
1. 修改~/.xbmc/userdata/addon_data/script.raspbmc.settings/settings.xml文件把sys.service.cron改成true,下次重启系统时自动开启cron服务。
2. 用“crontab -e”命令行添加新的计划任务,格式:几分 几时 几日 几月 星期几 命令行,用*号代替任意值。
3. 用“sudo /etc/init.d/cron start”启动计划任务服务。

(更多…)