Friday, July 9, 2010

TeamCity with LAMP Cent OS AMIs

 Installing MySQL 5
To install MySQL, we do this:
yum install mysql mysql-server
Then we create the system startup links for MySQL (so that MySQL starts automatically whenever the
system boots) and start the MySQL server:
chkconfig --levels 235 mysqld on
/etc/init.d/mysqld start
to set a password for the user root (otherwise anybody can access your MySQL database!):
[root@server1 ~]# mysql_secure_installation
In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none): <-- ENTER
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.
Set root password? [Y/n] <-- ENTER
New password: <-- yourrootsqlpassword
Re-enter new password: <-- yourrootsqlpassword
Password updated successfully!
Reloading privilege tables..
 ... Success!
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] <-- ENTER
 ... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] <-- ENTER
 ... Success!
By default, MySQL comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] <-- ENTER
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] <-- ENTER
 ... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MySQL
installation should now be secure.
Thanks for using MySQL!
Installing Apache2
Apache2 is available as a Fedora package, therefore we can install it like this:
yum install httpd
Now configure your system to start Apache at boot time...
chkconfig --levels 235 httpd on
... and start Apache:
/etc/init.d/httpd start
Now direct your browser to and you should see
the Apache2 placeholder
(( Optional ))
Installing PHP5
We can install PHP5 and the Apache PHP5 module as follows:
yum install php
We must restart Apache afterwards:
/etc/init.d/httpd restart
vi /var/www/html/info.php
Now we call that file in a browser (e.g. http://ec2-XX-xx-xxx-xxx.compute-
Getting MySQL Support In PHP5
To get MySQL support in PHP, we can install the php-mysql package. It's a good idea to install some
other PHP5 modules as well as you might need them for your applications. You can search for available
PHP5 modules like this:
yum search php
Pick the ones you need and install them like this:
yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-
eaccelerator php-magickwand php-magpierss php-mbstring php-mcrypt php-mssql php-shout php-
snmp php-soap php-tidy
Now restart Apache2:
/etc/init.d/httpd restart
Now reload in your browser and scroll
down to the modules section again. You should now find lots of new modules there, including the
MySQL module:
phpMyAdmin is a web interface through which you can manage your MySQL databases.
phpMyAdmin can be installed as follows:
yum install phpmyadmin
Now we configure phpMyAdmin. We change the Apache configuration so that phpMyAdmin allows
connections not just from localhost (by commenting out the
vi /etc/httpd/conf.d/phpMyAdmin.conf
# phpMyAdmin - Web based MySQL browser written in php
# Allows only localhost by default
# But allowing phpMyAdmin to anyone other than localhost should be considered
# dangerous unless properly secured by SSL
Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin
# order deny,allow
# deny from all
# allow from
# allow from ::1

# This directory does not require access over HTTP - taken from the original
# phpMyAdmin upstream tarball

   Order Deny,Allow
   Deny from All
   Allow from None

# This configuration prevents mod_security at phpMyAdmin directories from
# filtering SQL etc. This may break your mod_security implementation.
#      SecRuleInheritance Off


Restart Apache:
/etc/init.d/httpd restart
Afterwards, you can access phpMyAdmin under http://ec2-XXX-XX-XXX-XXX.compute-
Red Hat Enterprise Linux, CentOS, etc.
The OpenJDK 6 packages are also available in EPEL, a community-run project which makes Fedora
packages available to users of Red Hat Enterprise Linux 5, CentOS 5, and other RHEL 5 derivatives.
First install the package that enables the EPEL repository:
   $ su -c "rpm -Uvh"
If installing from a live image, such as a live CD or USB flash drive, add the OpenJDK 6 runtime after
the install:
   * To install with the graphical package manager, follow Applications > Add/Remove Software and
use search to find the package(s) to install.
   * To install from the command line:
       $ su -c "yum install java-1.6.0-openjdk"
     This package contains just the Java Runtime Environment. If you want to develop Java programs
then install the java-1.6.0-openjdk-devel package. You can also install all the OpenJDK 6 packages,
including the API documentation, by using the wildcard java-1.6.0-openjdk*.
On Fedora 8 the OpenJDK 7 runtime and development packages are installed by default during any
large-media install, such as from the Fedora 8 DVD, under the name IcedTea. If installing from a live
image then follow the above instructions but replace 1.6.0-openjdk with 1.7.0-icedtea.
 yum install tomcat5 tomcat5-webapps tomcat5-admin-webapps
Set JAVA_HOME / PATH for single user
Login to your account and open .bash_profile file
$ vi ~/.bash_profile
Set JAVA_HOME as follows using syntax export JAVA_HOME=. If your path is set
to /usr/java/jdk1.5.0_07/bin/java, set it as follows:
export JAVA_HOME=/usr/java/jdk1.6.0_16/bin/java
Set PATH as follows:
export PATH=$PATH:/usr/java/jdk1.6.0_16/bin
Save and close the file. Just logout and login back to see new changes:
$ echo $JAVA_HOME
$ echo $PATH
Edit the .bash_profile for Java Environment
export CATALINA_HOME=/opt/jetbrains/TeamCity
export PATH
export JAVA_HOME
Download TeamCity 5.1.2
# cd /opt
# mkdir jetbrains
# cd jetbrains
# mkdir TeamCity
# cp TeamCity-5.1.2.tar.gz /opt/jetbrains/TeamCity
# vi /opt/jetnrains/TeamCity/conf/server.xml
8543 will default port change to 8443
# service httpd restart
# chkconfig httpd on
# service mysqld restart
# chkconfig mysqld on
# service tomcat5 restart
# chkconfig tomcat5 on
# cd /opt/jetbrains/TeamCity/bin
TeamCity server can be started and stopped by the scripts provided in the /bin
To start/stop TeamCity server and default agent at the same time, use the runAll script.
To start/stop only the TeamCity server, use teamcity-server script.
For example:
   * Use runAll.bat start to start the server and the default agent
   * Use runAll.bat stop to stop the server and the default agent
By default, TeamCity runs on and has
one registered build agent that runs on the same computer.
Post a Comment