How to setup moinmoin as your personal wiki
Posted on Wed 12 February 2020 in Journal
Today is my birthday
Nobody grows old merely by a number of years. We grow old by deserting our ideals.
人变老主要不是因为痴长几年,而是丧失了理想
今天是我四十五的生日,废话不多说,不知不觉已过了不惑之年,不敢也不愿相信自己再过5年就年届半百。
心中的疑惑依然不少,虽然已经明白自己不过是一个非常普通的凡人,生在人世间,就象海洋中的一滴水,掀起不了多大的浪花。
可是依然心怀梦想,想当一个作家,写不了小说,起码能写点技术文章,希望交付的书稿能尽快出版。
还想多走一走,看一看这个世界,认识一些有趣的人,尝试一些有意思的事。
How to setup moinmoin as your personal wiki
1. Download moinmoin and prepare environment
sudo yum install epel-release -y
wget http://static.moinmo.in/files/moin-1.9.10.tar.gz
tar -zxvf moin-1.9.10.tar.gz
cd moin-1.9.10
sudo python setup.py install --force --record=install.log --prefix='/opt/moin' --install-data=/usr
cd /usr/share/moin/
sudo cp server/moin.wsgi moin.wsgi
vi /usr/share/moin/moin.wsgi
sys.path.insert(0, '/opt/moin/lib/python2.7/site-packages/')
sys.path.insert(0, '/usr/share/moin/')
cd /usr/share/moin
sudo cp config/wikiconfig.py wikiconfig.py
sudo sed -i 's/Untitled Wiki/Walter Personal Wiki/' /usr/share/moin/wikiconfig.py
sudo sed -i '/#superuser/a\ superuser = [u\"admin\", ]' /usr/share/moin/wikiconfig.py
sudo sed -i '$a\ log_reverse_dns_lookups = False' /usr/share/moin/wikiconfig.py
sudo chown -R nginx:nginx /usr/share/moin
sudo chown -R nginx:nginx /opt/moin
2 Install nginx
Replace
server_name _;
with
server_name 203.0.113.1;
location / {
uwsgi_pass unix:///run/moin/moin.sock;
include uwsgi_params;
}
sudo nginx -t
sudo systemctl start nginx.service
sudo systemctl enable nginx.service
cd /usr/share/moin/ sudo cp server/moin.wsgi moin.wsgi Open the newly created config file using the vi text editor: sudo vi /srv/share/moin/moin.wsgi
3 Install and configure uWSGI
Acting as a hub between the Nginx web server and a Python application, uWSGI is designed to produce best performance using the high-performance uWSGI protocol. Next, let's take a look at how to install and configure uWSGI for running MoinMoin.
1) Use pip to install uWSGI as follows:
sudo yum install -y python-devel python-setuptools python-pip gcc
sudo pip install --upgrade pip
sudo pip install uwsgi
sudo mkdir /var/log/uwsgi
sudo chown nginx:nginx /var/log/uwsgi
sudo mkdir /run/moin
sudo chown nginx:nginx /run/moin
- create /usr/share/moin/uwsgi.ini
cat <<EOF | sudo tee -a /usr/share/moin/uwsgi.ini
[uwsgi]
uid = nginx
gid = nginx
socket = /run/moin/moin.sock
chmod-socket = 660
logto = /var/log/uwsgi/uwsgi.log
chdir = /usr/share/moin
wsgi-file = /usr/share/moin/moin.wsgi
master = true
processes = 3
max-requests = 200
harakiri = 30
vacuum = true
enable-threads = true
EOF
- create /etc/systemd/system/uwsgi.service
cat <<EOF | sudo tee -a /etc/systemd/system/uwsgi.service
[Unit]
Description=uWSGI instance to serve MoinMoin
After=syslog.target
[Service]
ExecStart=/usr/bin/uwsgi --ini /usr/share/moin/uwsgi.ini
RuntimeDirectory=uwsgi
Restart=always
KillSignal=SIGQUIT
Type=notify
StandardError=syslog
NotifyAccess=all
[Install]
WantedBy=multi-user.target
EOF