2018年4月

一斤装的油壶,10元

看到灶头上的塑胶油瓶旧了,贴的纸标签长乌霉,瓶口附近油垢堆起了膏状物,所以想买个油壶。

在网上挑了一下,心意价10元左右的,这个500ML,看起来还可以,就买了。

第二天收到,打开来看,拿着比划了一下,手感还可以。上边还写着“每人每天建议25克油”,如果一家四口人,每天100克,那每五天要加油。

you-hu-1.jpg
外包装

you-hu-2.jpg
手把不是很大

you-hu-3.jpg
一天25克,有多少人能做到

在新版本WHM (64.0)中安装php5.3

问题:Godaddy的虚拟服务器(VPS)产品中,绑定的系统是CentOS 6 + cPanel,支持php5.5以上的版本,但网站程序必须是php5.3

过程:

  1. 在 whm 里查看多版本的php中,并没有php5.3
    ea-php5.3-1.png
  2. yum groupinstall 'Development Tools' # 安装开发组件
  3. yum install epel-release # 增加软件安装源
  4. yum install sqlite-devel libxml2-devel bzip2-devel libcurl-devel libc-client-devel libmcrypt-devel aspell-devel libedit-devel libtidy-devel pcre-devel # 安装相关的开发包
  5. wget http://cn2.php.net/distributions/php-5.3.29.tar.gz # 下载php5.3源码包
  6. 解压到 /usr/src/php-5.3.29
  7. ./configure --enable-bcmath --enable-calendar --enable-exif --enable-ftp --enable-gd-native-ttf --enable-libxml --enable-mbstring --enable-pdo=shared --enable-sockets --enable-zip --prefix=/opt/php53 --with-bz2 --with-curl=/usr --with-freetype-dir=/usr --with-gd --with-imap=/usr --with-imap-ssl --with-jpeg-dir=/usr --with-kerberos --with-libdir=lib64 --with-libexpat-dir=/usr --with-libxml-dir=/usr --with-mcrypt=/usr --with-mysql=/usr --with-mysql-sock=/var/lib/mysql/mysql.sock --with-mysqli=/usr/bin/mysql_config --with-openssl=/usr --with-openssl-dir=/usr --with-pcre-regex=/usr --with-pdo-mysql=shared --with-pdo-sqlite=shared --with-pic --with-png-dir=/usr --with-sqlite=shared --with-tidy=/usr --with-xmlrpc --with-xpm-dir=/usr --with-zlib --with-zlib-dir=/usr # 配置
    ea-php5.3-4.png
  8. make && make install # 编译并安装(在/opt/php53)
    ea-php5.3-5.png
  9. vi /etc/apache2/conf.d/includes/pre_main_global.conf # 向apache的配置文件添加以下内容,令其默认使用php5.3

    AddHandler application/x-httpd-php53 php
    
    ScriptAlias /local-bin /opt/php53/bin
    Action application/x-httpd-php53 /local-bin/php-cgi
    
    <Directory "/opt/php53/bin">
     Order allow,deny
     Allow from all
    </Directory>

    ea-php5.3-2.png

  10. /etc/init.d/httpd reload # 重新加载apache配置参数
  11. 查看phpinfo输出信息,是php5.3版本了
    ea-php5.3-3.png

参考:

在阿里云ECS云服务器里安装Ubuntu 17.10官方系统

当前阿里云公共镜像提供了ubuntu 16.04,没有17.10,但看到论坛网友想要,所以实践。

环境:云服务器T5 2GB内存规格,原系统Debian 9 64位,目标是安装ubuntu官方的17.10版本。

过程:

  1. uname -a # 查看当前系统版本及磁盘使用情况
    ubuntu17-1.png
  2. mkdir /boot/ub && cd /boot/ub # 创建新目录ub,用于存放安装文件
  3. wget http://archive.ubuntu.com/ubuntu/dists/artful/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64/linux # 下载ubuntu的网络安装文件
  4. wget http://archive.ubuntu.com/ubuntu/dists/artful/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64/initrd.gz # 下载ubuntu的网络安装文件
    ubuntu17-2.png
  5. 重启ECS实例,在“管理终端”里操作,当看到启动选择菜单时,按c,进入grub命令
    ubuntu17-3.png
  6. 在grub里输入以下命令,手动启动ubuntu安装
    ubuntu17-5.png
  7. 开始ubuntu安装,语言选择
    ubuntu17-6.png
  8. 阿里云的VPC网络实例是可以自动分配到IP的,配置主机名
    ubuntu17-7.png
  9. 选择ubuntu的软件安装源
    ubuntu17-8.png
  10. 设置用户名
    ubuntu17-9.png
  11. 磁盘分区,本例是“使用整个磁盘”
    ubuntu17-10.png
  12. 本实例仅有一个系统盘,所以选择了vda
    ubuntu17-11.png
  13. 写入新的分区表
    ubuntu17-12.png
  14. 软件选择,本例仅选择OpenSSH server和Basic Ubuntu server
    ubuntu17-13.png
  15. 安装Grub启动管理器
    ubuntu17-14.png
  16. 设置UTC系统时钟
    ubuntu17-15.png
  17. 安装完成
    ubuntu17-16.png
  18. 在“管理终端”里看到的Ubuntu 17.10启动界面
    ubuntu17-17.png
  19. 但在“管理终端”里,仅能看到光标,并不会提示用户登录
    ubuntu17-18.png
  20. 远程通过ssh登录,正常
    ubuntu17-19.png

参考:https://help.ubuntu.com/community/Installation/NetbootInstallFromInternet

在 Debian Linux 里“压缩卷” - shrink partion

环境:Debian 9,例子中,将阿里云ECS云服务器默认的系统盘,40GB的/dev/vda1,划成30GB的/dev/vda1和10GB的/dev/vda2。

过程:

  1. df -h # 查看当前的磁盘使用情况,/dev/vda1 是40GB
    resize-2.png
  2. on-line shrinking not supported # 尝试直接运行resize2fs来压缩,提示错误,不允许对正在使用的分区进行压缩操作
    resize-3.png
  3. vi /etc/initramfs-tools/hooks/resizefs # 创建好脚本,复制好resize2fs

    #!/bin/sh
    
    set -e
    
    PREREQS=""
    
    prereqs() { echo "$PREREQS"; }
    
    case $1 in
     prereqs)
         prereqs
         exit 0
     ;;
    esac
    
    . /usr/share/initramfs-tools/hook-functions
    
    copy_exec /sbin/e2fsck
    copy_exec /sbin/resize2fs
    
    exit 0
  4. chmod +x /etc/initramfs-tools/hooks/resizefs # 添加执行权限
  5. vi /etc/initramfs-tools/scripts/local-premount/resizefs # 创建好脚本,在挂载/前进行resize2fs操作

    #!/bin/sh
    
    set -e
    
    PREREQS=""
    
    prereqs() { echo "$PREREQS"; }
    
    case "$1" in
     prereqs)
         prereqs
         exit 0
     ;;
    esac
    
    /sbin/e2fsck -yf /dev/vda1
    /sbin/resize2fs /dev/vda1 30G
    /sbin/e2fsck -yf /dev/vda1
  6. chmod +x /etc/initramfs-tools/scripts/local-premount/resizefs # 添加执行权限
    resize-4.png
  7. update-initramfs -u -v # 更新系统引导
    resize-5.png
  8. 重启系统后用 df 查看磁盘使用情况
    resize-6.png
  9. fdisk /dev/vda # 用fdisk删除vda1分区,再新建30GB的vda1分区和10GB容量的vda2分区
    resize-7.png
  10. rm /etc/initramfs-tools/hooks/resizefs /etc/initramfs-tools/scripts/local-premount/resizefs # 删除之前的启动脚本
  11. update-initramfs -u -v # 更新系统引导
  12. 重启系统后,用 fdisk -l 查看,可以看到相应的分区和容量信息
    resize-8.png

参考:https://serverfault.com/questions/528075/is-it-possible-to-on-line-shrink-a-ext4-volume-with-lvm

用微信小程序“深圳通”乘公交车

昨天从松枰村到光明新区人民医院附近的一个公司面试,出门时,我姐递过一张“深圳通”公交卡,说方便乘车,我没接,说试试手机上的“深圳通”扫码。

因为不熟悉线路,我是按手机地图里的导航来乘公交车的,去和回都转了一次公交车。其中三次是乘务员手持设备扫码,一次是前门自助设备扫码。自助扫码时,可能没对准扫码设备,车开了后才扫到,后边的一个小伙都比我先扫到。扣费情况,回来问了一下我姐,说是和实体卡的“深圳通”一样的计费标准(八折起,1.5小时内换乘额外优惠0.4元)。具体到我,去时花了2.8元,回时花了3.6元。单程约23公里,从单价且不考虑时间来看的话,公交车坐得挺值。

个人觉得,现在多数人出门不会忘记带手机,放到袋子里,付款时,手机比片式实卡“深圳通”好找,年轻人应该比较喜欢用微信小程序的“深圳通”来乘公交车,“扫码成功”。

使用方法也不难,在公交车上有贴二维码,乘务员有时也会指引乘客使用:发现 --> 小程序 --> 搜索“深圳通”

sz-tong-1.png
图1:"深圳通"交易记录

sz-tong-2.jpg
图2:乘务员教一个阿姨开始使用小程序“深圳通”

sz-tong-3.jpg
图3:这个年轻小伙主动请教乘务员怎么使用小程序“深圳通”

链接:https://www.shenzhentong.com/news/skyhui_101004003.html