分类 电脑 下的文章

腾讯服务器 - iredmail - 安装问题 - python web.py

环境:腾讯云香港机,iredmail 1.3.1,centos7

问题:iredmail安装完成后,在浏览器里访问 iredadmin 提示 Internal Server Error 出错。

过程:查看 /var/log/message 内容,

Jul 22 13:35:30 mail uwsgi: *** Operational MODE: preforking ***
Jul 22 13:35:30 mail uwsgi: Traceback (most recent call last):
Jul 22 13:35:30 mail uwsgi:  File "iredadmin.py", line 9, in <module>
Jul 22 13:35:30 mail uwsgi:
Jul 22 13:35:30 mail uwsgi: from libs import iredbase
Jul 22 13:35:30 mail uwsgi:  File "/opt/www/iRedAdmin-1.0/libs/iredbase.py", line 7, in <module>
Jul 22 13:35:30 mail uwsgi:
Jul 22 13:35:30 mail uwsgi: import web
Jul 22 13:35:30 mail uwsgi: ImportError
Jul 22 13:35:30 mail uwsgi: :
Jul 22 13:35:30 mail uwsgi: No module named web
Jul 22 13:35:30 mail uwsgi:
Jul 22 13:35:30 mail uwsgi: unable to load app 0 (mountpoint='') (callable not found or import error)
Jul 22 13:35:30 mail uwsgi: *** no app loaded. going in full dynamic mode ***

回查安装过程中,有相关的错误提示内容:

Complete!
[ INFO ] Installing required Python-3 modules with pip3: web.py>=0.51 web.py>=0.51
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3 install --user` instead.
Collecting web.py>=0.51
  The repository located at mirrors.tencentyun.com is not a trusted or secure host and is being ignored. If this repository is available via HTTPS it is recommended to use HTTPS instead, otherwise you may silence this warning and allow it anyways with '--trusted-host mirrors.tencentyun.com'.
  Could not find a version that satisfies the requirement web.py>=0.51 (from versions: )
No matching distribution found for web.py>=0.51
[ INFO ] Installing required Python-2 modules with pip2: web.py>=0.51 more-itertools==5.0.0 web.py>=0.51 more-itertools==5.0.0
Collecting web.py>=0.51
  The repository located at mirrors.tencentyun.com is not a trusted or secure host and is being ignored. If this repository is available via HTTPS it is recommended to use HTTPS instead, otherwise you may silence this warning and allow it anyways with '--trusted-host mirrors.tencentyun.com'.
  Could not find a version that satisfies the requirement web.py>=0.51 (from versions: )
No matching distribution found for web.py>=0.51
You are using pip version 8.1.2, however version 20.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

那么可尝试手工安装python的相关包,
pip3 install web.py>=0.51
pip2 install web.py>=0.51 more-itertools==5.0.0

然后再重启相应服务(iredamin和iredpad等),或重启系统后测试,可以正常登录到iredadmin进行管理了。

参考:https://forum.iredmail.org/topic17082-internal-server-error-iredadmin.html

宝塔面板 - 安装 php 7.3 - can't find evp.h

现象:通过宝塔面板,在“软件商店”里安装php7.3,失败,提示 can't find evp.h。

尝试:查找 evp.h 文件,发现有两个地方有,/usr/include/openssl/evp.h 和 /usr/local/src/openssl-1.1.1c/include/openssl/evp.h 。查看 /www/server/panel/install/php.sh 里的内容,php7.3安装的编译参数有 --with-openssl=/usr/local/openssl 。尝试将usr/local/src/openssl-1.1.1c/include/openssl/ 里的编译原文件复制到 /usr/local/openssl/include/openssl/ 后,再安装就成功了。

参考:

centos8 - xampp linux 5.5 - use a 32 bit compatibility library for your system - libnsl

问题:在centos8 64位系统里安装xampp for linux php 5.5,提示 “XAMPP is currently only availably as 32 bit application. Please use a 32 bit compatibility library for your system.”

尝试:可能是php使用了libnsl.so的模块,导致php加载出错。yum install libnsl 可安装 libnsl 后再次尝试。

参考:https://forums.centos.org/viewtopic.php?t=71785

笨方法制作 NetBSD 9 LiveCD

过程:

  1. 在 Windows 10 的 VirtualBox 里创建虚拟机,安装好 NetBSD 9 64位的系统
  2. 在 NetBSD 系统里,用 pkg_add 安装好mklivecd,用来自动生成netbsd内核及文件系统
  3. 可能因为mklivedcd没有更新,自动创建好的iso文件在虚拟机里测试,自动挂载临时文件系统时会报错,如提示找不到/rescure/mount_mfs等程序。Mounthing memory filesystem directories: dev, eval: /rescure/mount_mfs: not found...临时的解决办法是从根目录的相应位置将提到的程序复制到/rescure目录里
  4. 用mklivecd自动制作的iso文件,在带有光驱设备的虚拟机或带有IPMI虚拟光驱的服务器里测试,是可运行的,boot device:cd0 root on cdoa dumps on cd0b。但在使用pxelinux或grub的环境中无法找到文件系统,启动屏幕信息停留在 boot device: root device:
  5. 尝试转到grub引导方向。新建一个虚拟机,安装debian 10系统,用于grub引导测试。先是尝试用grub的knetbsd来引导mklivecd和netbsd官方的安装iso,都是提示如之前的错误提示,找不到文件root设备。按网上的教程,grub的kfreebsd是能成功引导FreeBSD的新版本安装镜像,但必须添加相应的模块和参数,如 kfreebsd_module ${freebsd_root}/cd.iso type=mfs_root, set kFreeBSD.vfs.root.mountfrom="cd9660:/dev/md0", set kFreeBSD.vfs.root.mountfrom.options=ro 我死搬硬套,将FreeBSD字样换成netbsd,无效。翻看grub的资料后,grub在knetbsd加载内核后,可以通过knetbsd_module_elf来加载安装光盘里的miniroot.kmod,成功启动,可以看到netbsd的安装欢迎信息。但我不知道如何将文件系统镜像塞到miniroot.kmod中,尝试在netbsd虚拟机里make miniroot.kmod,无预期效果(miniroot.kmod的个头不会增加,还是仅几百KB)
  6. 翻看netbsd的资料,是可以将ramdisk塞到内核netbsd中,ramdisk的程序可以通过list配置文件来增加。但我尝试很多次,均无法添加如可远程连接的程序,如telnetd,sshd和dropbear。用默认的ramdisk配置生成的文件塞到内核netbsd后,在grub是能直接knetbsd引导后启动,是netbsd的安装欢迎信息
  7. 尝试直接将mklivecd生成的iso目录创建ramdisk,然后塞到netbsd内核中,之后grub尝试加载netbsd内核,VirtualBox报错,Guru Meditation,强制退出虚拟机。估计netbsd的内核个头太大了,当时netbsd的内核约有230M
  8. 尝试通过crunchgen来生成静态、精简的程序,如只包括必须的init, login等,以减小ramdisk的个头,但失败,会报哪个未定义等等,即使已经将Makefile里提到的libs库都写到配置文件中,总crunchgen不成
  9. 回到mklivecd生成的iso目录(如netbsd安装说明提到的,最小化安装仅需base.tar.xz和etc.tar.xz),尝试先移除一些非必要的目录,如firmware(主要包含无线网卡的驱动文件);删除了netbsd内核,因为要的是文件系统,不是内核文件本身。然后看到usr目录占得多,干脆就先移走原来的usr/bin和usr/sbin目录,再测试要用到哪个程序,如login能不能用,不能用就将程序放回;删除几个非必须的usr/lib大个头文件。反复测试,直到将文件系统iso的目录大小减小到约83M(约95M带有ramdisk的netbsd内核可在grub成功引导)。用如 /usr/src/obj/tooldir.NetBSD-9.0-amd64/bin/nbmakefs -t ffs -s 65093632 ramdisk.fs.tmp iso 的命令生成指定大小的ramdisk.fs文件。用如 /usr/src/obj/tooldir.NetBSD-9.0-amd64/bin/x86_64--netbsd-mdsetimage -v netbsd ramdisk.fs.tmp 的命令来将ramdisk.fs文件塞到netbsd的内核中。netbsd的内核可用INSTALL的配置文件,指定 MEMORY_DISK_ROOT_SIZE=127200 (反复测试后,最大值可能不能超过152500)。最后,用 mkisofs -no-emul-boot -J -R -v -b bootxx_cd9660 -o NetBSD-9-LiveCD-3.iso iso2 的命令来生成可启动的iso文件,其中iso2是只包含boot,boot.catalog,boot.cfg,bootxx_cd9660和netbsd内核文件的“精简”目录,这样生成的 NetBSD-9-LiveCD-3.iso 大小约有83M,且能在虚拟机的光驱及debian系统中的grub引导
  10. 这个iso文件基本上是使用netbsd的默认内核,能识别到多数网卡及设备,默认启动dhcpcd和sshd,系统启动后自动获得IP及准备好sshd连接,默认密码是 drserver38nb 。测试时发现ssh连接提示 PTY allocation request failed on channel 0 ,在/stand里的ramfs_etc.tgz解压后,修改etc/rc.local,添加一行 mount_ptyfs ptyfs /dev/pts 以让系统启动后自动挂载/dev/pts,记得要为rc.local添加执行权限

NetBSD-9-LiveCD-3.iso 保存在“百度网盘”里(链接:https://pan.baidu.com/s/1w8JUC4NiEELrITFHKfSUPQ
提取码:lg3e),有时间玩的话,可以试试。文件验证值是:

  • SHA1:59286444F48C64791987F8F2F90F219AEA86A826
  • MD5:7103B64BD75460FBE69FF59924BD82D0
ssh root@144.172.126.250
Warning: Permanently added '144.172.126.250' (RSA) to the list of known hosts.
root@144.172.126.250's password:
X11 forwarding request failed on channel 0
NetBSD 9.0 (MKLIVECD_INSTALL_A2) #29: Fri Jul 3 17:50:52 CST 2020
We recommend that you create a non-root account and use su(1) for root access.
localhost# lsls
-sh: lsls: not found
localhost# ls -l /
total 149
-r--r--r--   1 root  wheel   1220 Feb 14 00:06 .cshrc
-r--r--r--   1 root  wheel    701 Feb 14 00:06 .profile
drwxr-xr-x   2 root  wheel   1024 Jul  1 14:16 bin
-r--r--r--   1 root  wheel  84408 Jun 30 14:43 boot
-rw-r--r--   1 root  wheel    172 Feb 14 00:06 boot.cfg
-r--r--r--   1 root  wheel   2048 Jun 30 14:43 bootxx_cd9660
drwxr-xr-x   9 root  wheel  41472 Jul  3 10:09 dev
drwxr-xr-x  30 root  wheel   2048 Jul  3 10:10 etc
drwxr-xr-x   4 root  wheel   2560 Feb 14 00:06 lib
drwxr-xr-x   2 root  wheel    512 Jul  3 09:32 libdata
drwxr-xr-x   5 root  wheel    512 Feb 14 00:06 libexec
drwxr-xr-x   2 root  wheel    512 Feb 14 00:06 mnt
drwxrwxrwt   6 root  wheel    512 Jul  3 10:09 ramfs
drwxr-xr-x   2 root  wheel    512 Jun 21 15:34 rescue
drwxr-xr-x   2 root  wheel    512 Jul  3 10:09 root
drwxr-xr-x   2 root  wheel   3072 Jul  1 14:16 sbin
drwxr-xr-x   2 root  wheel    512 Jul  3 07:54 stand
drwxrwxrwt   3 root  wheel    512 Jul  3 10:12 tmp
drwxr-xr-x  10 root  wheel    512 Jul  3 09:33 usr
drwxr-xr-x  24 root  wheel    512 Jul  3 10:09 var

参考:

在 CentOS7 里升级 MariaDB Server 10.4

现象:在导入Magento模板的数据库时,提示部分SQL查询出错,访问magento网站前台时提示错误,提示缺少一些数据表。

尝试:centos7默认安装源中的数据库mariadb版本是5.5,需要安装较新版本的mariadb,如10.4。

过程:

  1. wget https://downloads.mariadb.com/MariaDB/mariadb_repo_setup # 下载新安装源安装脚本
  2. chmod +x mariadb_repo_setup # 添加执行权限
  3. ./mariadb_repo_setup # 安装新安装源
  4. yum upgrade mariadb-server # 升级mariadb
  5. systemctl start mariadb.service # 启动mariadb
  6. 重新导入magento模板的数据库文件

参考: