-
Notifications
You must be signed in to change notification settings - Fork 1
server installation and other admin tasks
tampakrap edited this page Nov 21, 2012
·
2 revisions
vim /etc/portage/package.keywords
=sys-apps/portage-2.2* **
dev-python/django
dev-python/feedparser **
dev-python/feedgenerator
dev-python/beautifulsoup
dev-util/cloc
dev-python/mimeparse
dev-python/django-tastypie
vim /etc/portage/package.use
dev-python/django mysql
vim /etc/portage/package.mask
=dev-lang/python-3*
=dev-python/python-dateutil-2*
vim /etc/portage/sets/cronos
app-admin/cronolog
app-admin/logrotate
dev-python/beautifulsoup
dev-python/django
dev-python/django-tastypie
dev-python/feedparser
dev-python/lxml
dev-python/mysql-python
dev-python/pycrypto
dev-python/requests
www-apache/mod_wsgi
www-servers/apache
emerge -av @cronos
- Create a MySQL user and database
mkdir /var/code
git clone git://github.com/LinuxTeam-teilar/cronos.teilar.gr cronos
-
git checkout -b ${STABLE_BRANCH}
- Replace ${STABLE_BRANCH} with the appropriate number
useradd cronos -d /var/code/cronos
chown cronos: /var/code/cronos -R
chmod 750 /var/code/cronos
cp cronos/local_settings.py.settings cronos/local_settings.py
vim cronos/local_settings.py
TODO
usermod -a -G cronos apache
mkdir -p /var/www/cronos.teilar.gr/htdocs/{site,media}
vim /etc/apache2/vhosts.d/cronos.teilar.gr.conf
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /var/www/cronos.teilar.gr/htdocs
ServerName cronos.teilar.gr
WSGIScriptAlias / /var/code/cronos/cronos/wsgi.py
WSGIPassAuthorization On
<Directory "/var/code/cronos/cronos">
<Files wsgi.py>
Order allow,deny
Allow from all
</Files>
</Directory>
Alias /robots.txt /var/www/cronos.teilar.gr/htdocs/static/robots.txt
<Location "/robots.txt">
Order allow,deny
Allow from all
</Location>
Alias /media/ /var/www/cronos.teilar.gr/htdocs/media/
<Directory "/var/www/cronos.teilar.gr/htdocs/media">
Order allow,deny
Allow from all
</Directory>
Alias /static/ /var/www/cronos.teilar.gr/htdocs/static/
<Directory "/var/www/cronos.teilar.gr/htdocs/static">
Order allow,deny
Allow from all
</Directory>
AliasMatch ^/([^/]*\.css) /var/code/cronos/static/styles/$1
CustomLog "|/usr/sbin/cronolog /var/log/apache2/cronos.teilar.gr/access-%Y%m%d.log" combined
ErrorLog "|/usr/sbin/cronolog /var/log/apache2/cronos.teilar.gr/error-%Y%m%d.log"
LogLevel warn
</VirtualHost>
# vim :ts=4 filetype=apache
/etc/init.d/apache2 start
vim /etc/syslog-ng/syslog-ng.conf
@version: 3.2
# Copyright 2005-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-admin/syslog-ng/files/syslog-ng.conf.gentoo.hardened.3.2,v 1.1 2011/01/18 17:44:14 mr_bones_ Exp $
#
# Syslog-ng configuration file, compatible with default hardened installations.
#
options {
chain_hostnames(no);
stats_freq(43200);
};
source src {
unix-stream("/dev/log");
internal();
};
source kernsrc {
# file("/proc/kmsg");
};
#source net { udp(); };
#log { source(net); destination(net_logs); };
#destination net_logs { file("/var/log/HOSTS/$HOST/$YEAR$MONTH$DAY.log"); };
destination authlog { file("/var/log/auth.log"); };
destination _syslog { file("/var/log/syslog"); };
destination cron { file("/var/log/cron.log"); };
destination daemon { file("/var/log/daemon.log"); };
destination kern { file("/var/log/kern.log"); file("/dev/tty12"); };
destination lpr { file("/var/log/lpr.log"); };
destination user { file("/var/log/user.log"); };
destination uucp { file("/var/log/uucp.log"); };
#destination ppp { file("/var/log/ppp.log"); };
destination mail { file("/var/log/mail.log"); };
destination avc { file("/var/log/avc.log"); };
destination audit { file("/var/log/audit.log"); };
destination pax { file("/var/log/pax.log"); };
destination grsec { file("/var/log/grsec.log"); };
destination mailinfo { file("/var/log/mail.info"); };
destination mailwarn { file("/var/log/mail.warn"); };
destination mailerr { file("/var/log/mail.err"); };
destination newscrit { file("/var/log/news/news.crit"); };
destination newserr { file("/var/log/news/news.err"); };
destination newsnotice { file("/var/log/news/news.notice"); };
destination debug { file("/var/log/debug"); };
destination messages { file("/var/log/messages"); };
destination console { usertty("root"); };
destination console_all { file("/dev/tty12"); };
#destination loghost { udp("loghost" port(999)); };
destination xconsole { pipe("/dev/xconsole"); };
destination cronos_info { file("/var/log/cronos/info.log"); };
destination cronos_warning { file("/var/log/cronos/warning.log"); };
destination cronos_error { file("/var/log/cronos/error.log"); };
destination cronos_critical { file("/var/log/cronos/critical.log"); };
destination cronos-dev_info { file("/var/log/cronos-dev/info.log"); };
destination cronos-dev_warning { file("/var/log/cronos-dev/warning.log"); };
destination cronos-dev_error { file("/var/log/cronos-dev/error.log"); };
destination cronos-dev_critical { file("/var/log/cronos-dev/critical.log"); };
filter f_auth { facility(auth); };
filter f_authpriv { facility(auth, authpriv); };
filter f_syslog { not facility(authpriv, mail); };
filter f_cron { facility(cron); };
filter f_daemon { facility(daemon); };
filter f_kern { facility(kern); };
filter f_lpr { facility(lpr); };
filter f_mail { facility(mail); };
filter f_user { facility(user); };
filter f_uucp { facility(uucp); };
#filter f_ppp { facility(ppp); };
filter f_news { facility(news); };
filter f_debug { not facility(auth, authpriv, news, mail);
and not program("cronos");
and not program("cronos-dev"); };
filter f_messages { level(info..warn)
and not facility(auth, authpriv, mail, news);
and not program("cronos");
and not program("cronos-dev"); };
filter f_emergency { level(emerg); };
filter f_info { level(info); };
filter f_notice { level(notice); };
filter f_warn { level(warn); };
filter f_crit { level(crit); };
filter f_err { level(err); };
filter f_avc { message(".*avc: .*"); };
filter f_audit { message("^(\\[.*\..*\] |)audit.*") and not message(".*avc: .*"); };
filter f_pax { message("^(\\[.*\..*\] |)PAX:.*"); };
filter f_grsec { message("^(\\[.*\..*\] |)grsec:.*"); };
filter f_cronos { program("cronos"); and not program("cronos-dev"); };
filter f_cronos-dev { program("cronos-dev"); };
log { source(src); filter(f_authpriv); destination(authlog); };
log { source(src); filter(f_syslog); destination(_syslog); };
log { source(src); filter(f_cron); destination(cron); };
log { source(src); filter(f_daemon); destination(daemon); };
log { source(kernsrc); filter(f_kern); destination(kern); };
log { source(src); filter(f_lpr); destination(lpr); };
log { source(src); filter(f_mail); destination(mail); };
log { source(src); filter(f_user); destination(user); };
log { source(src); filter(f_uucp); destination(uucp); };
log { source(kernsrc); filter(f_pax); destination(pax); };
log { source(kernsrc); filter(f_grsec); destination(grsec); };
log { source(kernsrc); filter(f_audit); destination(audit); };
log { source(kernsrc); filter(f_avc); destination(avc); };
log { source(src); filter(f_mail); filter(f_info); destination(mailinfo); };
log { source(src); filter(f_mail); filter(f_warn); destination(mailwarn); };
log { source(src); filter(f_mail); filter(f_err); destination(mailerr); };
log { source(src); filter(f_news); filter(f_crit); destination(newscrit); };
log { source(src); filter(f_news); filter(f_err); destination(newserr); };
log { source(src); filter(f_news); filter(f_notice); destination(newsnotice); };
log { source(src); filter(f_debug); destination(debug); };
log { source(src); filter(f_messages); destination(messages); };
log { source(src); filter(f_emergency); destination(console); };
#log { source(src); filter(f_ppp); destination(ppp); };
log { source(src); destination(console_all); };
log { source(src); filter(f_cronos); filter(f_info); destination(cronos_info); };
log { source(src); filter(f_cronos); filter(f_warn); destination(cronos_warning); };
log { source(src); filter(f_cronos); filter(f_err); destination(cronos_error); };
log { source(src); filter(f_cronos); filter(f_crit); destination(cronos_critical); };
log { source(src); filter(f_cronos-dev); filter(f_info); destination(cronos-dev_info); };
log { source(src); filter(f_cronos-dev); filter(f_warn); destination(cronos-dev_warning); };
log { source(src); filter(f_cronos-dev); filter(f_err); destination(cronos-dev_error); };
log { source(src); filter(f_cronos-dev); filter(f_crit); destination(cronos-dev_critical); };
vim /etc/logrotate.d/cronos
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
/var/log/cronos/info.log /var/log/cronos/warning.log /var/log/cronos/error.log {
create 660 root cronos
sharedscripts
missingok
postrotate
/etc/init.d/syslog-ng reload > /dev/null 2>&1 || true
endscript
}
vim /etc/cron.d/cronos
CRONOS_PATH="/var/code/cronos"
8,38 * * * * root /bin/bash ${CRONOS_PATH}/bin/logs_create_fix_perms.sh
20,50 * * * * cronos ${CRONOS_PATH}/bin/update_cronos.sh -p ${CRONOS_PATH} -u -c -r -d
CRONOS_DEV_PATH="/var/code/cronos-dev"
#12,42 * * * * cronos-dev ${CRONOS_DEV_PATH}/bin/update_cronos.sh -p ${CRONOS_DEV_PATH} -c -r -d
-
/root/create_cronos_personal_instance $NEW_USER
- Replace $NEW_USER with the desired username
- The script will ask for mysql root password
su - cronos
bin/update_cronos.sh -p . -u -c
/etc/init.d/apache2 restart