Ferrets家的Wordpress

CentOS

Linux发行版之一,来自于Red Hat Enterprise Linux依照开放源代码规定释出的源代码所编译而成

CentOS下web服务器无法发送邮件的权限修复

2017年1月16日 by Ferrets Leave a Comment

不得不承认,不愧是服务器血统,这权限管理真的严格的,搭建好的owncloud报告没法发邮件,经过一番bing之后,找到了答案。

参考:http://stackoverflow.com/questions/25517281/swiftmailer-connection-could-not-be-established-with-host-smtp-gmail-com-conne

解决办法如下:

  1.  检查httpd_can_sendmail 是否设置为on
    getsebool httpd_can_sendmail
    • 如果返回的输出是 httpd_can_sendmail –> off , 运行
      setsebool -P httpd_can_sendmail 1
    • 如果你看到 httpd_can_sendmail –> on 那么跳到下一步
  2.  检查 httpd_can_network_connect 是否为on
    getsebool httpd_can_network_connect
    • 如果返回的输出是 httpd_can_network_connect –> off ,运行
      setsebool -P httpd_can_network_connect 1
    • 如果你看到 httpd_can_network_connect –> on 那么就跳到下一步
  3. 在服务器地址直接填ip而不是域名。

第三步感觉是另外的问题,而不是SELinux的权限阻止了邮件发送。

Posted in: 搭建服务 Tagged: Apache, CentOS, http, httpd_can_network_connect, httpd_can_sendmail, php, SELinux, smtp, web, 权限

CentOS用apache当web服务器时出现的权限问题

2016年12月10日 by Ferrets Leave a Comment

参考:https://blog.lysender.com/2015/07/centos-7-selinux-php-apache-cannot-writeaccess-file-no-matter-what/

一般的文件读写权限,所属用户和组这些先不讨论,毕竟这些相关的文档太多,也相对基础了点。这里记录的是CentOS种由SELinux引起的权限问题。

刚在家重新搭建了owncloud,这时候出现了一个非常诡异的权限问题,文件和文件夹的所有权都是apache(CentOS中默认的所属用户和用户组),但是访问owncloud的安装程序的时候却提示没有写权限。我试过用sudo切换到apache用户来执行touch创建文件,没问题,甚至写一个简易的php脚本来测试文件的读写,都没有遇到权限的问题,但是在使用浏览器访问的时候,php脚本就遇到了权限的问题。

经过一番Google,确定时SELinux的问题。

用ls -Z可以看到一些额外的属性,像这样

drwxr-xr-x. apache apache unconfined_u:object_r:httpd_sys_content_t:s0 application
-rw-r--r--. apache apache unconfined_u:object_r:httpd_sys_content_t:s0 index.php
修复的办法是
# SELinux serve files off Apache, resursive
sudo chcon -t httpd_sys_content_t /data/www/html/sites/mysite -R
# Allow write only to specific dirs
sudo chcon -t httpd_sys_rw_content_t /data/www/html/sites/mysite/logs -R
sudo chcon -t httpd_sys_rw_content_t /data/www/html/sites/mysite/uploads -R

httpd_sys_content_t – 允许apache读取文档
httpd_sys_rw_content_t – 允许apache读写文档
更加详细的标记说明,可以参考https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Managing_Confined_Services/sect-Managing_Confined_Services-The_Apache_HTTP_Server-Types.html

Posted in: 网络 Tagged: CentOS, permission, readwrite, Redhat, SELinux, 权限, 读写

CentOS安装32位wine

2016年2月9日 by Ferrets Leave a Comment

最近给小主机换成了CentOS,感觉人性化了非常多(虽然软件仓库还是缺少很多挺好用的货),于是就顺手想把wine给装上(我才不会乱说因为跑个有毒的game.exe中招了于是顺手换系统),于是出现了奇怪的问题,大量exe文件无法运行,报告一个错误

fixme:service:scmdatabase_autostart_services Auto-start service L"MountMgr" failed to start: 2
wine: Bad EXE format for Z:\home\ferrets\桌面\winbox.exe.

而且,wine的配置器也报告了类似的问题。

2016-02-09 18-29-46 的屏幕截图

经过一番Google,在CentOS的论坛上找到了答案,因为某些上游开发者的决策“要保持CentOS的64位纯洁性”,而砍掉了32位支持,只要去装个32位的wine就能解决。于是我找到了这篇教程。

非常典型编译过程:

先安装工具包

yum groupinstall 'Development Tools'
yum install libX11-devel freetype-devel zlib-devel libxcb-devel

然后,下载源码,解压:

cd /usr/src wget http://dl.winehq.org/wine/source/1.8/wine-1.8.tar.bz2
tar xjf wine-1.8.tar.bz2

解压之后configure:

32位系统用: ./configure
64位系统用: ./configure --enable-win64

最后编译和安装:

make
make install

装完了运行一下作个测试。

32位系统运行:
# wine --version

64位系统运行:
# wine64 --version

不出什么意外的话安装就完成了

Posted in: Linux Tagged: CentOS, Linux, wine

在CentOS上安装NetworkManager-pptp

2012年3月20日 by Ferrets Leave a Comment

嗯,因为换了CentOS,所以在设置VPN的时候也出问题了,发现根本没有添加VPN的选项(Ubuntu在这方面做的好多了),于是上网各种查。

得到的参考有很多,不过都说到了一个软件包 NetworkManager-pptp

这个就是关键了

找遍了Google,大多数教程都指向一个网址“”,结果一查询,发现根本没有这个域名……真是坑爹啊。

最后还有老实人好,有个博客指出了一个可用的ftp服务器“ftp://mirror.switch.ch/“,还是找到了想要的软件包。

装完  NetworkManager-pptp之后,重启(不知道为何,我装了很多东西都要重启)就能在网络管理器那里添加pptp的VPN了。

Posted in: Linux Tagged: CentOS, PPTP, VPN

在CentOS上使用RPMforge

2012年3月11日 by Ferrets Leave a Comment

嗯,最近在尝试win8之后打算卸掉呢,再考虑到一直都是玩debian系的Linux,就手痒装了个CentOS

只是CentOS的软件库不是很大,于是需要点第三方源,比如说RPMforge

 

参考:在CentOS 6上使用RPMforge安装源(软件仓库)


导入DAG GPG密钥:

rpm --import 

下载并校验RPMforge软件包:

# 以下地址适用于CentOS 6,其他版本请参考官方文档
# 如果是i686系统,请wget下面地址的RPM包
wget 
# 如果是x86_64系统,请wget下面地址的RPM包
wget  
rpm -K rpmforge-release-0.5.2-2.el6.rf.*.rpm

校验完毕后,使用下面的命令安装:

rpm -i rpmforge-release-0.5.2-2.el6.rf.*.rpm

接着就是安装软件了。

Posted in: Linux Tagged: CentOS, RPMforge

CentOS 5.3 下快速安装配置 PPTP VPN 服务器

2011年12月20日 by Ferrets Leave a Comment

来源:http://blog.s135.com/pptp_vpn/

 

—————————————————————

一、CentOS 5.3 下 PPTP VPN 服务器安装

1、安装相关软件

32位版:

yum install -y ppp iptables
wget http://poptop.sourceforge.net/yum/stable/packages/pptpd-1.4.0-1.rhel5.x86_64.rpm
rpm -ivh pptpd-1.3.4-2.rhel5.i386.rpm

64位版:

yum install -y ppp iptables
wget http://poptop.sourceforge.net/yum/stable/packages/pptpd-1.4.0-1.rhel5.x86_64.rpm
rpm -ivh pptpd-1.3.4-2.rhel5.x86_64.rpm

2、配置文件编写

①、配置文件/etc/ppp/options.pptpd

mv /etc/ppp/options.pptpd /etc/ppp/options.pptpd.bak
vi /etc/ppp/options.pptpd

输入以下内容: [阅读全文]

Posted in: Linux, 搭建服务 Tagged: CentOS, iptables, PPTP, VPN

日历

2021年1月
一二三四五六日
 123
45678910
11121314151617
18192021222324
25262728293031
« 10月    

分类目录

  • Android
  • docker
  • Linux
  • OpenWrt
  • PHP
  • RaspberryPi
  • RouterOS
  • 吐槽
  • 搭建服务
  • 未分类
  • 生活
  • 网络

近期文章

  • 建立私有docker镜像源
  • RouterOS上抵挡扫描的防火墙策略
  • Windows Server作为Mikrotik设备管理员的3A服务器
  • 使用ipv6连接Proxmox VE
  • 根据audit.log来放通SELinux的拦截
  • 使用PXE从NFS服务器启动Debian Linux
  • 在运行ArchlinuxARM的PogoPlug上打开CPU的AES硬件加速
  • 增大mysql/mariadb的最大连接数
  • 又发现一个神器—个人CalDAV/CardDAV服务器
  • 在使用动态ip的情况下使用tunnelbroker

友链

  • ntzyz's space
  • Openwrt中文论坛
  • SNGR
  • Trevikids行止由心
  • 煎蛋

文章归档

功能

  • 登录
  • 条目feed
  • 评论feed
  • WordPress.org

Copyright © 2021 Ferrets家的Wordpress.

Beta WordPress Theme by themehall.com