FOSSGIS/Server/Social

From OpenStreetMap Wiki
Jump to navigation Jump to search

Deutsche Beschreibung

Wordpress-Multisite-Umgebung für Wochennotiz, weeklyOSM und Podcast inklusive Verteilserver für Video und Audiodateien.

English description

Wordpress-Multisite-Environment for Wochennotiz, weeklyOSM and Podcast including delivery of video and audio files.

Server

VServer/Container auf bessel (vgl. https://www.fossgis.de/wiki/IT-Technik)

mit extra IP: 139.17.3.227

Setup Protokoll

Im Mai 2013 aufgesetzt durch MaZderMind (peter AT mazdermind DOT de)

# change hostname from blog to social
root@blog:~# echo "social" >/etc/hostname
root@blog:~# hostname social
root@social:~# echo '127.0.0.1       social' >> /etc/hosts
root@social:~# echo '::1             social' >> /etc/hosts

# install some packages I personally rely on :)
root@social:~# apt-get install sudo htop less subversion git curl bash-completion pv

# red-warning prompt on the root account
root@social:~# echo "PS1='\[\e]0;\u@\h: \w\a\]\[\033[01;31m\]\u\[\033[01;31m\]@\[\033[01;31m\]\h \[\033[01;31m\]\w \[\033[01;31m\]$ \[\033[00m\]'" >> /root/.bashrc
root@social:~# echo "export PS1" >> /root/.bashrc

# add common group
addgroup --gid 2004 osmblogadmin

# create my local user
root@social ~ $ export LUSER=mazdermind
root@social ~ $ export ID=2029
root@social ~ $ addgroup --gid $ID $LUSER
root@social ~ $ adduser --uid $ID --gid $ID --disabled-password $LUSER
root@social ~ $ usermod -p "" $LUSER
root@social ~ $ chage -d 0 $LUSER
root@social ~ $ su $LUSER -c "mkdir /home/$LUSER/.ssh"
root@social ~ $ chmod 700 /home/$LUSER/.ssh
root@social ~ $ scp mazdermind@bessel:/home/$LUSER/.ssh/authorized_keys /home/$LUSER/.ssh/authorized_keys
root@social ~ $ chmod 600 /home/$LUSER/.ssh/authorized_keys
root@social ~ $ chown -R $LUSER.$LUSER /home/$LUSER/.ssh
root@social ~ $ scp mazdermind@bessel:/home/$LUSER/.forward /home/$LUSER/.forward
root@social ~ $ usermod -aG sudo,osmblogadmin $LUSER

# nice color prompt on my account
root@social ~ $ su mazdermind
mazdermind@social:/root$ cd ~
mazdermind@social:~$ echo "PS1='\[\e]0;\u@\h: \w\a\]\[\033[01;31m\]\u\[\033[01;33m\]@\[\033[01;32m\]\h \[\033[01;33m\]\w \[\033[01;35m\]$ \[\033[00m\]'" >> ~/.bashrc
mazdermind@social:~$ echo "export PS1" >> ~/.bashrc

# create my buddies local user
root@social ~ $ export LUSER=mafeu
root@social ~ $ export ID=2033
root@social ~ $ addgroup --gid $ID $LUSER
root@social ~ $ adduser --uid $ID --gid $ID --disabled-password $LUSER
root@social ~ $ usermod -p "" $LUSER
root@social ~ $ usermod -aG sudo,osmblogadmin $LUSER
root@social ~ $ chage -d 0 $LUSER

root@social ~ $ su $LUSER -c "mkdir /home/$LUSER/.ssh"
root@social ~ $ chmod 700 /home/$LUSER/.ssh

root@social ~ $ nano /home/$LUSER/.ssh/authorized_keys
root@social ~ $ chmod 600 /home/$LUSER/.ssh/authorized_keys
root@social ~ $ chown -R $LUSER.$LUSER /home/$LUSER/.ssh

root@social ~ $ nano /home/$LUSER/.forward
root@social ~ $ chown -R $LUSER.$LUSER /home/$LUSER/.forward

# nice color prompt their account
root@social ~ $ echo "PS1='\[\e]0;\u@\h: \w\a\]\[\033[01;31m\]\u\[\033[01;33m\]@\[\033[01;32m\]\h \[\033[01;33m\]\w \[\033[01;35m\]$ \[\033[00m\]'" >> /home/$LUSER/.bashrc
root@social ~ $ chown -R $LUSER.$LUSER /home/$LUSER/.bashrc

root@social ~ $ export LUSER=mac_do
root@social ~ $ export ID=2034
root@social ~ $ addgroup --gid $ID $LUSER
root@social ~ $ adduser --uid $ID --gid $ID --disabled-password $LUSER
root@social ~ $ usermod -p "" $LUSER
root@social ~ $ usermod -aG sudo,osmblogadmin $LUSER
root@social ~ $ chage -d 0 $LUSER

root@social ~ $ su $LUSER -c "mkdir /home/$LUSER/.ssh"
root@social ~ $ chmod 700 /home/$LUSER/.ssh

root@social ~ $ nano /home/$LUSER/.ssh/authorized_keys
root@social ~ $ chmod 600 /home/$LUSER/.ssh/authorized_keys
root@social ~ $ chown -R $LUSER.$LUSER /home/$LUSER/.ssh

root@social ~ $ nano /home/$LUSER/.forward
root@social ~ $ chown -R $LUSER.$LUSER /home/$LUSER/.forward

# nice color prompt their account
root@social ~ $ echo "PS1='\[\e]0;\u@\h: \w\a\]\[\033[01;31m\]\u\[\033[01;33m\]@\[\033[01;32m\]\h \[\033[01;33m\]\w \[\033[01;35m\]$ \[\033[00m\]'" >> /home/$LUSER/.bashrc
root@social ~ $ chown -R $LUSER.$LUSER /home/$LUSER/.bashrc
# create my buddies local user
root@social ~ $ export LUSER=andi
root@social ~ $ export ID=2035
root@social ~ $ addgroup --gid $ID $LUSER
root@social ~ $ adduser --uid $ID --gid $ID --disabled-password $LUSER
root@social ~ $ usermod -p "" $LUSER
root@social ~ $ usermod -aG sudo,osmblogadmin $LUSER
root@social ~ $ chage -d 0 $LUSER

root@social ~ $ su $LUSER -c "mkdir /home/$LUSER/.ssh"
root@social ~ $ chmod 700 /home/$LUSER/.ssh

root@social ~ $ nano /home/$LUSER/.ssh/authorized_keys
root@social ~ $ chmod 600 /home/$LUSER/.ssh/authorized_keys
root@social ~ $ chown -R $LUSER.$LUSER /home/$LUSER/.ssh

root@social ~ $ nano /home/$LUSER/.forward
root@social ~ $ chown -R $LUSER.$LUSER /home/$LUSER/.forward 

# nice color prompt their account
root@social ~ $ echo "PS1='\[\e]0;\u@\h: \w\a\]\[\033[01;31m\]\u\[\033[01;33m\]@\[\033[01;32m\]\h \[\033[01;33m\]\w \[\033[01;35m\]$ \[\033[00m\]'" >> /home/$LUSER/.bashrc
root@social ~ $ chown -R $LUSER.$LUSER /home/$LUSER/.bashrc
# setup default docroot and wordpress
mazdermind@social ~ $ sudo mkdir -p /var/www/default/htdocs
mazdermind@social ~ $ sudo mv /var/www/index.html /var/www/default/htdocs/
mazdermind@social ~ $ sudo sed -i 's@/var/www@/var/www/default/htdocs@g' /etc/apache2/sites-available/default
mazdermind@social ~ $ sudo mkdir -p /var/www/wordpress
mazdermind@social ~ $ sudo ln -s /usr/share/wordpress/ /var/www/wordpress/htdocs

# configured /etc/apache2/sites-available/default and /etc/apache2/sites-available/wordpress
# - disable access logging
# - set ServerNames
#	ServerName blog.openstreetmap.de
#	ServerAlias test.blog.openstreetmap.de
#
#	ServerName podcast.openstreetmap.de
#	ServerAlias test.podcast.openstreetmap.de
#
# - set Alias for Uploads
#/var/www/wordpress/wp-uploads

# enable wordpress configuration
root@social ~ $ /etc/apache2/sites-enabled $ ln -s ../sites-available/wordpress /etc/apache2/sites-enabled/

# restart server
root@social ~ $ /etc/apache2/sites-enabled $ sudo service apache2 reload

# copy blog config from humboldt
# - /etc/wordpress/*

# set up root user
root@social ~ $ echo 'GRANT ALL PRIVILEGES ON *.* TO root@localhost;' | mysql -udebian-sys-maint -p
root@social ~ $ echo 'SET PASSWORD FOR root@localhost = PASSWORD(...);' | mysql -udebian-sys-maint -p 

# set up wpblog database and user
root@social ~ $ echo 'CREATE DATABASE wpblog;' | mysql -p
root@social ~ $ echo 'CREATE USER wpblog@localhost;' | mysql -p
root@social ~ $ echo 'GRANT ALL PRIVILEGES ON wpblog.* TO wpblog@localhost;' | mysql -p
root@social ~ $ echo 'SET PASSWORD FOR wpblog@localhost = PASSWORD(...);' | mysql -p

# enable access for normal user accounts to the wpblog database
root@social ~ $ echo 'GRANT ALL PRIVILEGES ON wpblog.* TO ``@localhost;' | mysql -p

# tuned mysql config
#see /etc/mysql/conf.d/tuning.cnf

# copy database from humboldt
root@social ~ $ ssh humboldt 'mysqldump wpblog -uroot -p' | pv | mysql wpblog

# copy theme, plugins and uploads from humbolt
rsync -av humboldt:/osm/blog/wp-uploads/ /var/lib/wordpress/wp-content/uploads
rsync -av humboldt:/usr/share/wordpress/wp-content/plugins/ /usr/share/wordpress/wp-content/plugins
rsync -av humboldt:/usr/share/wordpress/wp-content/themes/osmblog/ /usr/share/wordpress/wp-content/themes/osmblog

# symlink the theme into the frontend
ln -s /usr/share/wordpress/wp-content/themes/osmblog /var/lib/wordpress/wp-content/themes/