Posts Tagged mysql

WVC-min… all 3-in-1


I used to be a pure command line junky… maybe that was just immaturity as an admin… thinking I was cool because I didn’t rely on any type of GUI… Well I have moved on from that thought process and I use a GUI quite a bit now… well a lot more than I used to anyway… so I thought I would share the 9-liner that I use to get it all running…

Oh and the pic here is from my son… the Artists’ rendering of “Super Diaper Baby,” I felt it appropriate since I just took mine off 🙂

#!/bin/bash
# Virtualmin, Webmin & Cloudmin Installation
yum install -y wget
cd /usr/src
wget http://software.virtualmin.com/gpl/scripts/install.sh
sh install.sh
wget http://cloudmin.virtualmin.com/gpl/scripts/cloudmin-gpl-redhat-install.sh
sh cloudmin-gpl-redhat-install.sh
# END
Advertisements

, , , , , , , , , , , ,

Leave a comment

WordPress Automation


OK so I had a few minutes to spare today and I  decided to finalize this mini-automation script for WordPress installs.  Keep in mind that  the assumption is made that you have used Virtualmin to create the preliminary aspects, vhost, mysql, doc root, etc… If not… this ain’t gonna work as it is.  I guess I could work up a more in-depth script to include these aspects, in fact that is how I started this idea in the first place, but the aspects of virtualmin really are pretty extensive and since I am using that to manage the vhosts anyway I just skipped that part, I mean why try to improve on a great integration aspect, besides it is unlikely I could do it better anyway.  I would however like to translate this piece into a Perl mod to be added to the virtualmin GUI, that would be a cool improvement.

#/bin/bash

#

echo “Make sure you have created this VHost using virtualmin FIRST…”

sleep 5

echo “OK… moving on then”

sleep 2

echo “Enter the name of your new site, then press [ENTER}”

read newblog

# You need these if you are NOT using virtualmin FIRST !!

# mkdir /var/www/html/$newblog

# useradd -c ‘$newblog user’ -p ‘$newblog’ $newblog

# chown -R $newblog:$newblog $newblog

cd /home/$newblog/public_html

wget http://www.wordpress.org/latest.tar.gz

tar xzf latest.tar.gz

rm -Rf latest.tar.gz

mv wordpress/* .

rm -Rf wordpress

chmod 777 .

# Link the themes & plugins from the default repo

# This makes the assumption that you actually HAVE a repo for themes and plugins…

# If you don’t this ain’t gonna do what we need it to !!

cd /home/$newblog/public_html/wp-content

mv themes bak.themes # <– Just in case we hose everything 😦

# Make the link directorie(s), if necessary and link ’em up

mkdir -p /var/www/repo/themes

ln -s /var/www/repo/themes /home/$newblog/public_html/wp-content/themes

mv plugins bak.plugins

mkdir -p /var/www/repo/plugins

ln -s /var/www/repo/plugins /home/$newblog/public_html/wp-content/plugins

cd ../

cp wp-config-sample.php wp-config.php

#

#

# Final directions

# Open the editor if needed but SED will do what you need

# vi wp-config.php

sed -i ‘s/putyourdbnamehere/’$newblog’/’ wp-config.php

sed -i ‘s/usernamehere/’$newblog’/’ wp-config.php

sed -i ‘s/yourpasswordhere/’$newblog’/’ wp-config.php

chown -R $newblog:$newblog *

# EOF

If you need webmin/virtualmin/cloudmin (I HIGHLY recommend them) you can spin this off:

# Virtualmin/Webmin/Cloudmin Installation

# cd /usr/src

# wget http://software.virtualmin.com/gpl/scripts/install.sh

# sh install.sh

# wegt http://cloudmin.virtualmin.com/gpl/scripts/cloudmin-gpl-redhat-install.sh

# sh cloudmin-gpl-redhat-install.sh

And that’s it! Just navigate to your new URL (assuming that you made the proper DNS entries…) and configure WordPress from its admin console.  I also thought this tutorial on SED was pretty useful although what I used here is very basic, just in case you need something more.

http://www.grymoire.com/Unix/Sed.html

Happy Blogging 🙂

, , , , , , , , , ,

3 Comments

mySQL ‘Quick Tips’


These worked for me setting up my WordPress blogs so I thought I should @ least include them in their entirety for anyone else doing what I am doing.

linuxhelp.net

yolinux.com

, , , , ,

Leave a comment

WordPress 1 2 3 (… 4 5 6?)


I thought I would add a quick How-To on installing WordPress where it is not already present… Redundant? Well that’s OK… It can be a lot of fun to mess around with WordPress (designing), especially if you don’t know PHP (like me).   So this tutorial… if you can even call it that… will get you started on basically any linux server, however I am partial to centOS (currently centOS5.4) so these steps are tested and certified to work on only CentOS release 5.4 (Final).  Shouldn’t take more than 10 minutes to do this so that is not so bad right?  Oh and my base install is basically CD1 (.iso1) of the centOS release with no options selected… so this is a totally bare bones OS, no GUI no nuttin’.  That being said, I have really lost track of what I have on the system (which is silly because that was the purpose of doing this as a ‘bare-bones’ build… I guess that’s what you get when you don’t have a specific purpose in mind BEFORE you build a system) that was a pre-req for WordPress so I will just spew out an RPM listing for you… although the install will certainly complain if you don’t have anything beyond what I am listing in the body of the guide.  Maybe I will put that list @ the bottom of the post… Hmmm.. why can’t I add scroll bars here??? Odd, well anyway…

Here we go…

wordpress setup:

# Create a local non-root user (if not already present)
# Check defaults first:
[root@centOS54 wordpress]# useradd -D
GROUP=100
HOME=/home
INACTIVE=-1
EXPIRE=
SHELL=/bin/bash
SKEL=/etc/skel
CREATE_MAIL_SPOOL=yes
# now add the user:
useradd -c ‘Garot Conklin’ gmc <– Hey, that’s me 🙂 This can obviously be anything you want
passwd gmc
# Navigate to /var/www/html/
# create dir /wordpress
mkdir wordpress
Install required packages:
yum install httpd php mysql mysql-server php-mysql perl-Net-SSLeay <– Oops forgot one… perl-Net-SSLeay
# start and test apache2
start mysql:

service mysqld start

I know basically nothing about database installations so just follow these directions and you will be fine as well, what I mean is that WordPress will function, LOL.  That being said, this config certainly works, but may not be correct or the ‘optimal’ configuration.

# configure mysql:
mysqladmin -u root password ‘XXXXXX’ <– ya this may not be very secure… and may defeat the purpose of setting up the non-root user… LOL (maybe that’s not funny?)

This next command gets you into the database admin role: (That may not have been entirely clear)
[root@centOS54 wordpress]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.0.77 Source distribution

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.

mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> insert into
-> host(host,db,Select_priv, Insert_priv, Update_priv, Delete_priv, Create_priv, Drop_priv)
-> values(‘linuxbox’, ‘%’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’);
Query OK, 1 row affected (0.00 sec)

mysql> insert into
-> user (host, user, password)
-> values(‘localhost’, ‘gmc’, password(‘XXXXXXXX’));
Query OK, 1 row affected, 3 warnings (0.00 sec)

mysql> quit
Bye
# Create the database and name it ‘wordpress’
[root@centOS54 wordpress]# mysqladmin -u root -p create wordpress <– You can name the database whatever you want here
Enter password:
[root@centOS54 wordpress]# mysqladmin -u root -p reload
Enter password:

# Fetch wordpress
wget http://wordpress.org/latest.tar.gz
extract it into /var/www/html/wordpress
# Edit wp-config-sample.php:
vi wp-config-sample.php

// ** MySQL settings – You can get this info from your web host ** //
/** The name of the database for WordPress */
define(‘DB_NAME’, ‘wordpress’);

/** MySQL database username */
define(‘DB_USER’, ‘root’);

/** MySQL database password */
define(‘DB_PASSWORD’, ‘XXXXXXXX’); <– replace all the XXXXXXX’s with the real password (in case that was not obvious?)

/** MySQL hostname */
define(‘DB_HOST’, ‘localhost’);

Re-name it:
cp wp-config-sample.php wp-config.php

# Reload/re-start daemons <– I don’t recall if these last 2 reloads were even necessary… doesn’t hurt though
mysqladmin -u root -p reload
service httpd restart

Done !

Navigate to http://<IP/hostname>/wordpress/wp-admin and off you go WordPress-ing !! 🙂

Oops.. almost forgot the RPM listing — Nope it is just too big of a list without the scroll bars… that are oddly stripped out of my code when I ‘update’ the page??? Maybe that is restriction of the free hosted blog? Anyway, it is not really necessary… you will know what you need outside of anything listed here… Hope this helped at least someone… LOL 🙂

, , , , , , , , ,

Leave a comment