厨房瞎鼓捣 - 马铃薯胡萝卜馅酿皮豆腐
翻箱底,找到12个红萝卜,且是迷你版的红萝止。然后削马铃薯皮,把红萝卜和马铃薯切碎,伴些生粉,成素馅。酿馅皮豆腐。每块豆腐馅上镶一条小鱼。然后蒸约20分钟,出锅,铺上三条麦菜,开吃。怎么感觉不到有生粉的存在?
翻箱底,找到12个红萝卜,且是迷你版的红萝止。然后削马铃薯皮,把红萝卜和马铃薯切碎,伴些生粉,成素馅。酿馅皮豆腐。每块豆腐馅上镶一条小鱼。然后蒸约20分钟,出锅,铺上三条麦菜,开吃。怎么感觉不到有生粉的存在?
在菜市场买了饺皮、猪肉馅、黄瓜。黄瓜切成圆片状,垫盘底。胡萝卜和少许黄瓜剁小块,与猪肉馅搅和。包好饺子,蒸约15分钟。熟后的饺子底面烂,但另一面,特别是饺子边显得有些硬。盘底的黄瓜蒸软得挟不起来了。
云友“一滴水2015”想知道 flask 在阿里云的运行示例 ,所以搜索资料,实践如下。
环境:debian 7 64位。在本例,假设flask文件存储在用户aliyun用户目录中。
过程:
1.编辑 /etc/apt/sources.list 内容,以适合当前系统版本:
deb http://mirrors.aliyuncs.com/debian/ wheezy main non-free contrib
deb http://mirrors.aliyuncs.com/debian/ wheezy-updates main non-free contrib
deb http://mirrors.aliyuncs.com/debian/ wheezy-backports main non-free contrib
deb-src http://mirrors.aliyuncs.com/debian/ wheezy main non-free contrib
deb-src http://mirrors.aliyuncs.com/debian/ wheezy-updates main non-free contrib
deb-src http://mirrors.aliyuncs.com/debian/ wheezy-backports main non-free contrib
deb http://mirrors.aliyuncs.com/debian-security/ wheezy/updates main non-free contrib
deb-src http://mirrors.aliyuncs.com/debian-security/ wheezy/updates main non-free contrib
2.更新软件源:
apt-get update
3.安装相关的软件:
apt-get install python-pip python-dev nginx
4.安装 virtualenv
pip install virtualenv
5.切换到 aliyun 用户,创建目录 myapps
su aliyun
mkdir ~/myapps
cd ~/myapps
6.创建虚拟环境:
virtualenv myappsenv
7.激活当前虚拟环境:
source myappsenv/bin/activate
8.安装 uwsgi 和 flask
pip install uwsgi flask
9.创建一个新的测试文件 hello.py ,内容如下:
from flask import Flask
application = Flask(__name__)
@application.route("/")
def hello():
return "<h1 style='color:blue'>Hello Aliyun!</h1>"
if __name__ == "__main__":
application.run(host='0.0.0.0')
10.测试,是否能运行成功:
python hello.py
11.创建 wsgi.py 文件,内容如下:
from hello import application
if __name__ == "__main__":
application.run()
12.运行 uwsgi,看看是否成功:
uwsgi --socket 0.0.0.0:8000 --protocol=http -w wsgi
13.退出python虚拟环境:
deactivate
14.创建uwsgi配置文件 myapp.ini,内容如下:
[uwsgi]
module = wsgi
master = true
processes = 2
uid = aliyun
gid = www-data
socket = myapp.sock
chmod-socket = 660
vacuum = true
die-on-term = true
15.返回到root账户,创建uwsgi启动脚本 /etc/init.d/myapp 内容如下:
#! /bin/sh
### BEGIN INIT INFO
# Provides: myapp
# Should-Start: console-screen dbus network-manager
# Required-Start: $remote_fs $network $local_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start myprogram at boot time
### END INIT INFO
#
PROGRAMNAME="uwsgi"
case "$1" in
start)
/bin/su - aliyun -c "source /home/aliyun/myapps/myappsenv/bin/activate; cd /home/aliyun/myapps; uwsgi --ini myapp.ini" &
;;
stop)
skill $PROGRAMNAME
;;
esac
exit 0
16.为此脚本设置为执行权限,且开机自启动:
chmod +x /etc/init.d/myapp
insserv myapp
17.创建nginx站点配置文件 /etc/nginx/sites-available/myapp ,内容如下:
server {
listen 80;
server_name yun.anqun.org;
location / {
include uwsgi_params;
uwsgi_pass unix:/home/aliyun/myapps/myapp.sock;
}
}
18.启用站点,且将www-data用户加到aliyun组中:
ln -s /etc/nginx/sites-available/myapp /etc/nginx/sites-enabled
usermod -a -G aliyun www-data
19.重启系统,测试是否能访问:
reboot
参数:
应 云友 - “mango爱好 ” 在 帖子 要求,找在 CentOS 7 系统安装 nginx + uWSGI + Diango 的资料。
找到一篇英文的,粗略翻译及实践如下,此例中是假设将相应的文件放在 liujia 用户目录下(/home/liujia),以普通用户 liujia 用户登录到控制台:
1.添加 EPEL 软件源:
sudo yum install epel-release
2.安装 pip 工具:
sudo yum install python-pip
3.安装 python 虚拟环境工具:
sudo pip install virtualenv virtualenvwrapper
4.更改bash Shell的设置:
echo "export WORKON_HOME=~/Env" >> ~/.bashrc
echo "source /usr/bin/virtualenvwrapper.sh" >> ~/.bashrc
source ~/.bashrc
5.创建第一个python应用:
mkvirtualenv firstsite
6.安装 diango
pip install django
7.生成相应的目录:
cd ~
django-admin.py startproject firstsite
8.完成基本设置,如设置管理用户名和密码:
cd ~/firstsite
./manage.py migrate
./manage.py createsuperuser
9.编辑配置文件,在末行添加静态文件目录:
vi firstsite/settings.py
STATIC_ROOT = os.path.join(BASE_DIR, "static/")
10.更新应用设置,自动生成 static 目录:
./manage.py collectstatic
11.测试应用是否能正常运行,如果在浏览器里能访问8080端口的内容,即成功:
./manage.py runserver 0.0.0.0:8080
12.安装 python 开发包:
sudo yum install python-devel gcc
13.安装uWSGI:
sudo pip install uwsgi
14.测试 uWSGi 是否能正常运行:
uwsgi --http :8080 --home /home/user/Env/firstsite --chdir /home/user/firstsite -w firstsite.wsgi
15.创建 uWSGI 运行的配置文件 firstsite.ini:
sudo mkdir -p /etc/uwsgi/sites
cd /etc/uwsgi/sites
sudo vi firstsite.ini
配置文件内容如下:
[uwsgi]
project = firstsite
username = liujia
base = /home/%(username)
chdir = %(base)/%(project)
home = %(base)/Env/%(project)
module = %(project).wsgi:application
master = true
processes = 5
uid = %(username)
socket = /run/uwsgi/%(project).sock
chown-socket = %(username):nginx
chmod-socket = 660
vacuum = true
16.创建 uWSGI 启动脚本 uwsgi.service:
sudo vi /etc/systemd/system/uwsgi.service
文件内容如下:
[Unit]
Description=uWSGI Emperor service
[Service]
ExecStartPre=/usr/bin/bash -c 'mkdir -p /run/uwsgi; chown liujia:nginx /run/uwsgi'
ExecStart=/usr/bin/uwsgi --emperor /etc/uwsgi/sites
Restart=always
KillSignal=SIGQUIT
Type=notify
NotifyAccess=all
[Install]
WantedBy=multi-user.target
17.安装 nginx:
sudo yum install nginx
18.编辑 nginx 的配置文件,添加 server 内容:
sudo nano /etc/nginx/nginx.conf
增加的内容如下:
server {
listen 80;
server_name portal.anqun.org;
location = favicon.ico { access_log off; log_not_found off; }
location /static/ {
root /home/liujia/firstsite;
}
location / {
include uwsgi_params;
uwsgi_pass unix:/run/uwsgi/firstsite.sock;
}
}
19.保存后测试配置文件是否有错误:
sudo nginx -t
20.将普通用户 nginx 加到 liujia 组中:
sudo usermod -a -G liujia nginx
chmod 710 /home/liujia
21.启动 uWSGI 和 nginx 服务:
sudo systemctl start nginx
sudo systemctl start uwsgi
22.如果启动成功,将俩服务设置为自动启动:
sudo systemctl enable nginx
sudo systemctl enable uwsgi
源文:How To Serve Django Applications with uWSGI and Nginx on CentOS 7, https://www.digitalocean.com/community/tutorials/how-to-serve-django-applications-with-uwsgi-and-nginx-on-centos-7
感谢罗老板。
环境: CentOS 6 64位。
目的:安装好 Kaltura 程序。安装包有的在国外,安装完成,可能需要4小时左右。
过程:
1.编辑 /etc/hosts 文件,设置主机名:
2.关闭防火墙:
iptables -F
service iptables stop
chkconfig iptables off
3.禁用 SELinux:
setenforce permissive
4.安装 Kaltura 软件源:
rpm -ihv http://installrepo.kaltura.org/releases/kaltura-release.noarch.rpm
5.安装并配置 mysql 数据库服务端:
yum install mysql mysql-server
service mysqld start
mysql_secure_installation
chkconfig mysqld on
4.重启 postfix 邮件服务:
service postfix restart
5.安装 Kaltura 程序包:
yum clean all
yum install kaltura-server
6.运行 mysql 配置脚本:
/opt/kaltura/bin/kaltura-mysql-settings.sh
7.重启 memcached, ntpd 服务:
service memcached restart
service ntpd restart
chkconfig memcached on
chkconfig ntpd on
8.运行 Kaltura 配置脚本,按提示选择或输入,关键是设置好站点的URL地址:
/opt/kaltura/bin/kaltura-config-all.sh
9.安装 red5-server 软件:
yum install kaltura-red5
10.请自行想办法(如用国外代理),下载文件oflaDemo-java6.war,放到 /usr/lib/red5/webapps 目录:
proxychains wget http://red5.googlecode.com/svn/snapshots/oflaDemo-java6.war
11.修改文件 /usr/lib/red5/webapps/oflaDemo/index.html 中的 localhost 为实际的网站地址,如 yun.anqun.org :
12.访问地址,如 http://yun.anqun.org:5080/oflaDemo/ 测试演示视频是否能正确播放:
13.执行 red5-server 配置脚本:
/opt/kaltura/bin/kaltura-red5-config.sh
源文:Installing Kaltura on a Single Server (RPM), https://github.com/kaltura/platform-install-packages/blob/master/doc/install-kaltura-redhat-based.md