Lokvin Wiki
No edit summary
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
==How to set up development environment (Desktop Linux Fedora18 x64)==
 
==How to set up development environment (Desktop Linux Fedora18 x64)==
   
===1. Before Start===
 
 
RCOM environment is really complicated, here we only set up a minimal version which helps you get started, the guide is not meant to help you learn any details. After you learn the very details of RCOM env you can throw away this guide, choose what ever linux distribution you like, install applications to where ever you want, set it up as you like, as long as you know how it works and what you are doing ...
 
 
You probably will encounter errors if you try to apply this guide to other Linux distribution. In that case, you need to make necessary modifications or ask help from RCOM team.
 
 
 
This guide has been updated (but not tested) and you can choose newer version of Fedora.
 
 
===2. System Setup===
 
'''CAUTION: These steps should be run as root.'''
 
 
====1) OS Installation====
 
Use network install os, restart pc and press F12, select fedora 18 x86
 
Set the default root password is 'wearethebest'.
 
   
 
====enable sudo to your account ====
 
====enable sudo to your account ====
Line 63: Line 48:
 
shell>sudo systemctl start memcached.service
 
shell>sudo systemctl start memcached.service
   
====install chrome ====
 
http://www.if-not-true-then-false.com/2010/install-google-chrome-with-yum-on-fedora-red-hat-rhel/
 
 
====install jdk ====
 
http://10.90.22.6/reutersmediawiki/index.php/BjMediaDev/Projects/2010/03/IPhone_App/Startup_installguide#JDK
 
   
 
====install eclipse ====
 
====install eclipse ====
Line 91: Line 71:
 
[yufei@localhost bin]$ sudo ln -s /usr/local/maven-2.2.1/bin/mvn mvn
 
[yufei@localhost bin]$ sudo ln -s /usr/local/maven-2.2.1/bin/mvn mvn
 
[yufei@localhost bin]$ sudo ln -s /usr/local/maven-3.0.5/bin/mvn mvn3
 
[yufei@localhost bin]$ sudo ln -s /usr/local/maven-3.0.5/bin/mvn mvn3
  +
====add custon alias ====
 
  +
* add custom alias to fe18, add shell file to /etc/profile.d/ , such as : yufei_alias.sh
====install mysql ====
 
  +
[yufei@localhost profile.d]$ pwd
http://10.90.22.6/reutersmediawiki/index.php/BjMediaDev/Projects/2010/03/IPhone_App/Startup_installguide#MYSQL
 
  +
/etc/profile.d
 
  +
[yufei@localhost profile.d]$ cat yufei_alias.sh
====2) DHCP====
 
  +
alias jumprcom='ssh jump@10.90.7.23'
We need dhclient, not NetworkManager
 
  +
alias jumpagency='ssh appdev@10.90.7.23'
# chkconfig --level 2345 NetworkManager off
 
# chkconfig --level 2345 network on
 
# /etc/init.d/NetworkManager stop
 
# /etc/init.d/network restart
 
====3) DNS====
 
##if no /etc/dhclient-eth0.conf
 
shell>touch /etc/dhclient-eth0.conf
 
 
# echo 'prepend domain-name "g3.reuters.com " ;' >> /etc/dhclient-eth0.conf
 
# echo "prepend domain-name-servers 10.35.59.232 ;" >> /etc/dhclient-eth0.conf
 
# /etc/init.d/network restart
 
 
Now you should be able to lookup our SIT boxes:
 
# nslookup idevbj-stage-repo
 
 
====4) Proxy (for yum)====
 
# echo "proxy=<nowiki>http://10.90.7.56:3128/</nowiki>" >> /etc/yum.conf
 
 
Now yum should be able to access internet through the proxy
 
# yum list mysql
 
 
====5) Change root password====
 
# passwd
 
====6) Add a user for daily use====
 
Replace xxx with your user name
 
# useradd -m -s /bin/bash xxx
 
 
Set password for this user
 
# passwd xxx
 
====7) Disable selinux====
 
If the output is not "SELINUX=disabled", edit /etc/selinux/config and change the line to "SELINUX=disabled". If there's no such a line, add it.
 
# cat /etc/selinux/config | grep "^SELINUX="
 
====8) Grant sudo privilege to the daily user you add ====
 
Replace xxx with your username
 
# echo "xxx ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
 
 
====9) Reboot system and login with your user====
 
# reboot
 
 
===3. RCOM Environment Setup===
 
'''CAUTION: All the following steps should be running as the user you add for daily usage.'''
 
 
====1) Create directory structures, set permission, add rcom users.====
 
 
Save the following content as a file, say /tmp/bootstrap.sh
 
#!/bin/sh
 
 
if [ "`id -u`" != "0" ]; then
 
echo "Must run as root!"
 
exit 1
 
fi
 
 
echo "Creating directories ... "
 
mkdir -p /data01/home
 
mkdir -p /data01/opt/apache22
 
mkdir -p /data01/opt/tomcat
 
mkdir -p /data01/rt/apache/admin/htdocs
 
mkdir -p /data01/rt/apps
 
mkdir -p /data01/rt/properties
 
mkdir -p /data01/rt/tomcat
 
mkdir -p /data02/usr/local/mysql/data
 
mkdir -p /data02/rt/apache
 
mkdir -p /data02/rt/logs/apache22
 
mkdir -p /data02/rt/logs/tomcat/cms
 
mkdir -p /usr/java
 
 
echo "Creating symbolic links ... "
 
rm -rf /rt && ln -sfn /data01/rt /rt
 
rm -rf /data01/rt/logs && ln -sfn /data02/rt/logs /data01/rt/logs
 
rm -rf /usr/local/mysql && ln -sfn /data02/usr/local/mysql /usr/local/mysql
 
rm -rf /opt/apache22 && ln -sfn /data01/opt/apache22 /opt/apache22
 
 
echo "Creating user & group ... "
 
[ "`cat /etc/group | grep ^rcom: | wc -l`" == "0" ] && /usr/sbin/groupadd rcom
 
id rcomcms 1>/dev/null 2>&1 || /usr/sbin/useradd -d /data01/home/rcomcms -m -s /bin/bash -g rcom rcomcms
 
id mysql 1>/dev/null 2>&1 || /usr/sbin/useradd -d /data01/home/mysql -m -s /bin/bash -g rcom mysql
 
 
echo "Setting directories owner & permission ... "
 
chown root.root /usr/java
 
chown root.root /data01 /data01/home /data01/opt /data01/opt/tomcat /data01/rt /data01/rt/apps
 
chown root.root /data02 /data02/usr /data02/usr/local /data02/rt /data02/rt/logs
 
chown root.rcom /data01/rt/properties /data02/rt/logs/tomcat
 
chown daemon.rcom /data01/opt/apache22 /data01/rt/apache /data02/rt/apache /data02/rt/logs/apache22
 
chown rcomcms.rcom /data01/rt/tomcat /data02/rt/logs/tomcat/cms
 
chmod 775 /data01/rt/properties
 
 
Then make it executable, and run it
 
$ chmod a+x /tmp/bootstrap.sh
 
$ sudo /tmp/bootstrap.sh
 
 
====2) Set environment variables====
 
$ sudo touch /etc/profile.d/g3profile.sh
 
$ sudo chmod 755 /etc/profile.d/g3profile.sh
 
 
$ sudo su -
 
# echo "export BASE_RT_DIR=/rt" >> /etc/profile.d/g3profile.sh
 
# echo "export JAVA_HOME=/usr/java/jdk" >> /etc/profile.d/g3profile.sh
 
# echo "export proxy_http=10.90.7.56:3128" >> /etc/profile.d/g3profile.sh
 
$ exit
 
 
$ echo "export PATH=$PATH:/sbin:/usr/sbin:$JAVA_HOME/bin" >> ~/.bash_profile
 
 
Then logout and login to make the new env var take effect,
 
or source it (you need to source it in every terminal, so you'd better logout, login)
 
$ source /etc/profile.d/g3profile.sh
 
$ source ~/.bash_profile
 
 
====3) Install daily tools by yum (subversion, firefox, vnc)====
 
First check whether they are already installed
 
$ sudo yum list | grep installed | grep -i xxx
 
 
Usually they are already installed, so there's nothing to install.
 
If not, use yum to install firefox and vnc
 
$ sudo yum install xxx
 
 
But for subversion, the official subversion for fedora9 is too old (1.4.x),
 
we need a version which matches the subclipse version, which is 1.6.5.
 
Or, you should use subclipse 1.4.x which matches the official fc9 subversion 1.4.x).
 
You can find latest subversion and subclipse on http://subversion.tigris.org/
 
 
Follow the below steps to install subversion 1.6.5 or you can install
 
the latest version yourself if you know how to do.
 
 
Now remove the 1.4.x subversion if there is
 
$ sudo yum erase subversion
 
 
Now get the 1.6.5 subversion source
 
$ cd ~/Download
 
$ wget <nowiki>http://idevbj-stage-repo/subversion-1.6.5.tar.gz</nowiki>
 
$ tar xzvf subversion-1.6.5.tar.gz
 
 
Install apr/apr-util/neon devel packages if they are not installed, we need them to build subversion
 
$ sudo yum install apr-util-devel neon-devel
 
 
Or you can use subversion-deps-1.6.5.tar.gz which provides all necessary dependencies
 
$ cd ~/Download
 
$ wget <nowiki>http://idevbj-stage-repo/subversion-deps-1.6.5.tar.gz</nowiki>
 
$ tar xzvf subversion-deps-1.6.5.tar.gz
 
 
Now make & install subversion 1.6.5
 
$ cd subversion-1.6.5
 
$ ./configure
 
$ make
 
$ sudo make install
 
 
When you execute ./configure step, and find missing the sqlite3.c file. Then
 
$ wget http://absa.googlecode.com/files/sqlite-amalgamation-3.6.13.tar.gz
 
$ tar xzvf sqlite-amalgamation-3.6.13.tar.gz
 
$ cd subversion-1.6.5
 
$ mkdir sqlite-amalgamation
 
$ cp ~/Downloads/sqlite-3.6.13/sqlite3.c sqlite-amalgamation/
 
then you can install subversion 1.6.5.
 
 
Now check the subversion we installed, it should print version 1.6.5
 
$ cd ~ && svn --version
 
 
And check if svn works with http scheme
 
$ svn list <nowiki>http://10.90.0.160/svn</nowiki>
 
 
And of course, you can install newer version of firefox and vnc too, it's up to you.
 
Remember to add some handy firefox plugins, at lease we need firebug and foxyproxy
 
and we use this dynamic proxy "<nowiki>http://wtd.apac.ime.reuters.com/proxy.pac</nowiki>".
 
 
====4) Install jdk====
 
First we need to remove any existing gcj java
 
$ sudo rpm -qa | grep java
 
Replace the name with the one from above query command
 
$ sudo rpm -e --nodeps xxx
 
 
Now install our own jdk
 
$ cd /usr/java
 
$ sudo wget <nowiki>http://idevbj-stage-repo/jdk-6u22-linux-i586.bin</nowiki>
 
$ sudo chmod 755 jdk-6u22-linux-i586.bin
 
$ sudo ./jdk-6u22-linux-i586.bin
 
$ sudo ln -s jdk1.6.0_22 jdk
 
$ sudo rm -f jdk-6u22-linux-i586.bin
 
 
Now check it, it should give your 1.6.0_22
 
$ java -version
 
 
====5) Install Eclipse and subclipse====
 
Remember the version of subclipse you install should match the subversion you installed in above steps.
 
$ cd ~/Download
 
$ wget <nowiki>http://idevbj-stage-repo/eclipse-java-galileo-linux-gtk.tar.gz</nowiki>
 
$ wget <nowiki>http://www.tigris.org/files/documents/906/48441/site-1.6.15.zip</nowiki>
 
$ tar xzvf eclipse-java-galileo-linux-gtk.tar.gz -C ~/
 
$ unzip site-1.6.15.zip -d ~/eclipse
 
 
Now you should be able to start eclipse (You should create a launcher for it on your desktop)
 
$ ~/eclipse/eclipse
 
 
You probably want to increase the min/max memory for eclipse,
 
I use "-Xms768m" and "-Xmx1024m"
 
$ vi ~/eclipse/eclipse.ini
 
 
====6) Install maven====
 
First you should try install with yum, it probably will install a lot of dependencies
 
$ sudo yum install maven2
 
 
After it is successfully installed, remove java-gcj manually without checking dependencies
 
as described in "Install jdk" (because it could get installed again as dependency with maven
 
installation).
 
 
Configure maven to use RCOM maven repositry by editing /opt/maven2/conf/settings.xml or ~/.m2/settings.xml
 
1). Add the below proxy setting to the part of proxies
 
<proxy>
 
<id>ime proxy</id>
 
<active>true</active>
 
<protocol>http</protocol>
 
<host>10.90.7.56</host>
 
<port>3128</port>
 
<nonProxyHosts>10.90.0.160</nonProxyHosts>
 
</proxy>
 
 
2). Add server "repo" definition to servers part:
 
<server>
 
<id>repo</id>
 
<username>${your svn username}</username>
 
<password>${your svn password}</password>
 
</server>
 
 
3). Define profile "repositoryDefs" in profiles part:
 
<profile>
 
<id>repositoryDefs</id>
 
<repositories>
 
<repository>
 
<id>proxycache</id>
 
<name>Proxy of external maven repos</name>
 
<!-- this may be better off with a name -->
 
<url><nowiki>http://dev1.reuters.com:9999/repository</nowiki></url>
 
<!--url><nowiki>http://dev1.reuters.com:8081/artifactory/repo</nowiki></url-->
 
<releases>
 
<enabled>true</enabled>
 
</releases>
 
<snapshots>
 
<enabled>true</enabled>
 
<updatePolicy>always</updatePolicy>
 
<checksumPolicy>fail</checksumPolicy>
 
</snapshots>
 
</repository>
 
</repositories>
 
<pluginRepositories>
 
<pluginRepository>
 
<id>proxycache</id>
 
<name>Proxy of external maven repos</name>
 
<!-- this may be better off with a name -->
 
<url><nowiki>http://dev1.reuters.com:9999/repository</nowiki></url>
 
<releases>
 
<enabled>false</enabled>
 
</releases>
 
<snapshots>
 
<enabled>true</enabled>
 
<updatePolicy>daily</updatePolicy>
 
<checksumPolicy>fail</checksumPolicy>
 
</snapshots>
 
</pluginRepository>
 
</pluginRepositories>
 
</profile>
 
 
4). Active the above defined profile "repositoryDefs" through putting the follow code into <settings>:
 
<activeProfiles>
 
<activeProfile>repositoryDefs</activeProfile>
 
</activeProfiles>
 
 
====7) Install MySQL (Optional)====
 
Use the mysql server with your Linux distribution (version >= 5.1.31).
 
 
<strike>First we need to remove any existing mysql packages, but usually we only need to remove mysql-libs
 
 
Use this command to check mysql
 
$ sudo rpm -qa | grep -i mysql
 
 
Remove it without dependency checks
 
$ sudo rpm -e --nodeps mysql-libs-5.0.51a-1.fc9.i386
 
 
Now install our mysql packages
 
$ cd ~/Download
 
$ wget <nowiki>http://idevbj-stage-repo/MySQL-shared-advanced-gpl-5.1.31sp1-0.rhel4.i386.rpm</nowiki>
 
$ wget <nowiki>http://idevbj-stage-repo/MySQL-client-advanced-gpl-5.1.31sp1-0.rhel4.i386.rpm</nowiki>
 
$ wget <nowiki>http://idevbj-stage-repo/MySQL-server-advanced-gpl-5.1.31sp1-0.rhel4.i386.rpm</nowiki>
 
 
$ sudo rpm -Uvh MySQL-shared-advanced-gpl-5.1.31sp1-0.rhel4.i386.rpm
 
$ sudo rpm -Uvh MySQL-client-advanced-gpl-5.1.31sp1-0.rhel4.i386.rpm
 
$ sudo rpm -Uvh MySQL-server-advanced-gpl-5.1.31sp1-0.rhel4.i386.rpm
 
 
We don't want mysql server to run all the time,
 
we will start it manually when we need it. So stop it and set it not to auto-start
 
$ sudo /etc/init.d/mysql stop
 
$ sudo /sbin/chkconfig --level 2345 mysql off</strike>
 
 
==== 8) Install httpd and php ====
 
 
 
Install httpd
 
$sudo yum install zlib-devel
 
$cd ~/Downloads
 
$wget http://10.35.59.233/httpd-2.2.25.tar.gz
 
$tar zxvf httpd-2.2.25.tar.gz
 
$cd httpd-2.2.25
 
$./configure --prefix=/opt/apache22 --enable-mods-shared=all
 
$make
 
$sudo make install
 
 
==== 9) Setup admin httpd ====
 
 
Save the following content as a file, say /tmp/setup-httpd-admin.sh
 
 
#!/bin/sh
 
 
if [ "`id -u`"&nbsp;!= "0" ]; then
 
echo "Must run as root!"
 
exit 1
 
fi
 
 
IP=`/sbin/ifconfig eth0 | grep -oe "inet [^ ]*" | cut -d":" -f2`
 
if [ "$IP" == "" ]; then
 
echo "No IP Address detected, exit!"
 
exit 1
 
else
 
echo "Using IP address: $IP"
 
fi
 
 
 
echo "Installing httpd-admin configuration files ... "
 
cd /tmp
 
rm -f /tmp/httpd-admin-conf-dev.tgz
 
wget http://10.35.59.233/httpd-admin-conf-dev.tgz
 
tar xzf /tmp/httpd-admin-conf-dev.tgz -C /data01/opt/apache22
 
wget http://10.35.59.233/httpd-admin-modules.tgz
 
tar xzf /tmp/httpd-admin-modules.tgz -C /data01/opt/apache22
 
 
cd /data01/opt/apache22/conf/conf.d
 
m4 -D__IP__=$IP 10-rcom-admin-vhost.m4 &gt; 10-rcom-admin-vhost.conf
 
m4 -D__IP__=$IP admin.m4 &gt; admin.conf
 
STATIC_IP=`nslookup idevbj-static-01 | grep ^Address: | grep -v \# | cut -d' ' -f2`
 
sed -i "/Include conf\/extra\/rcom-keepalives.conf/ a \ RewriteRule ^/resources/(.*) <nowiki>http://</nowiki>$STATIC_IP:23880/resources/\$1" 10-rcom-admin-vhost.conf
 
 
echo "Resetting directory permission ... "
 
sudo chown -R daemon.rcom /data01/opt/apache22
 
 
echo "Cleaning ... "
 
sudo rm -rf /tmp/httpd-admin-conf-dev.tgz
 
sudo rm -rf /tmp/httpd-admin-modules.tgz
 
 
 
 
Now make it executable and run it
 
 
$ sudo chmod a+x /tmp/setup-httpd-admin.sh
 
$ sudo /tmp/setup-httpd-admin.sh
 
 
 
Now you should be able to start and stop httpd withour error
 
 
sudo /opt/apache22/bin/apachectl -k start
 
sudo /opt/apache22/bin/apachectl -k stop<strike>
 
</strike>
 
 
==== 10) Install tomcat ====
 
 
$ wget -O ~/Downloads/apache-tomcat-5.5.23-1.i386.rpm http://10.35.59.233/apache-tomcat-5.5.23-1.i386.rpm
 
$ cd ~/Downloads &amp;&amp; sudo rpm -Uvh apache-tomcat-5.5.23-1.i386.rpm
 
 
==== 11) Setup admin tomcat ====
 
 
Save the following content as a file, say /tmp/setup-tomcat-cms.sh
 
 
#!/bin/sh
 
 
if [ "`id -u`"&nbsp;!= "0" ]; then
 
echo "Must run as root!"
 
exit 1
 
fi
 
<strike>
 
</strike>IP=`/sbin/ifconfig eth0 | grep -oe "inet [^ ]*" | cut -d":" -f2`
 
if [ "$IP" == "" ]; then
 
echo "No IP Address detected, exit!"
 
exit 1
 
else
 
echo "Using IP address: $IP"
 
fi
 
 
echo "Preparing directory structure ... "
 
rm -rf /rt/tomcat/cms 1&gt;/dev/null 2&gt;&amp;1
 
rm -rf /rt/logs/tomcat/cms/* 1&gt;/dev/null 2&gt;&amp;1
 
rm -f /etc/init.d/tomcat-cms 1&gt;/dev/null 2&gt;&amp;1
 
mkdir -p /rt/tomcat/cms
 
 
echo "Setting up tomcat-cms ... "
 
cd /tmp
 
rm -f /tmp/tomcat-cms-dev.tgz
 
wget http://10.35.59.233/tomcat-cms-dev.tgz
 
tar xzf /tmp/tomcat-cms-dev.tgz -C /rt/tomcat
 
 
cd /rt/tomcat/cms
 
m4 -D__IP__=$IP tomcatctl.m4 &gt; tomcatctl
 
m4 -D__IP__=$IP tomcat-cms.initd.m4 &gt; tomcat-cms.initd
 
 
mv /rt/tomcat/cms/tomcat-cms.initd /etc/init.d/tomcat-cms
 
chown root.root /etc/init.d/tomcat-cms
 
chmod 755 /etc/init.d/tomcat-cms
 
 
echo "Reset permission ... "
 
chown -R rcomcms.rcom /rt/tomcat/cms
 
chown -R rcomcms.rcom /rt/logs/tomcat/cms
 
 
echo "Clean up ... "
 
 
Now make it executable and run it
 
 
$ sudo chmod a+x /tmp/setup-tomcat-cms.sh
 
$ sudo /tmp/setup-tomcat-cms.sh
 
 
Now you should be able to start/stop tomcat-cms
 
 
$ sudo /etc/init.d/tomcat-cms hardstart
 
$ sudo /etc/init.d/tomcat-cms hardstop
 
 
Check /rt/tomcat/cms/logs/catalina.out, make sure there is no error/exception in it.
 
create a test project in tomcat
 
$ sudo mkdir /rt/tomcat/cms/webapps/test
 
$ sudo vi /rt/tomcat/cms/webapps/test/index.html
 
If so, you should be able to see the hello page from your local box: http://your_ip:23863/test/
 
 
====12) Checkout svn modules====
 
 
'''DO NOT check our modules from svn directly, it will take a long time and consume the network resource. '''
 
 
You should copy the tar ball which contains almost all modules from our staging box (trunk, r591328),
 
and then switch all modules to the current branch, update with your own account. It's about 700MB, and extends
 
to 2.2GB after extract, so please make enough room for it.
 
 
First let's download it
 
$ cd ~/Download && wget <nowiki>http://10.35.59.233/rcom-svn-modules.tgz</nowiki>
 
 
if the download is still time consuming. you can scp it from staging box
 
$ cd ~/Download && scp distuser@10.35.59.233:/rt/staging/env-bootstrap/rcom-svn-modules.tgz . (passwd:2comdeployer)
 
 
Now extract it where you like, here we extract it to ~/work/rcom
 
$ mkdir -p ~/workspace/rcom
 
$ tar xzvf ~/workspace/rcom-svn-modules.tgz -C ~/workspace/rcom
 
 
First update with your svn account, enter the password when prompted
 
$ cd ~/workspace/rcom
 
$ svn upgrade rcom-all
 
$ svn up --username xxx rcom-all
 
 
 
And sub modules of rcom-all
 
$ cd ~/workspace/rcom/rcom-all
 
$ ALL_MODULES="`grep ^coremodules dev.mk | cut -d"=" -f2` `grep ^warmodules dev.mk | cut -d"=" -f2`"
 
$ for module in $ALL_MODULES; do svn upgrade $module; done
 
 
You can use the same technique to sync modules with svn repository
 
$ cd ~/workspace/rcom
 
$ svn up *
 
$ cd ~/workspace/rcom/rcom-all
 
$ ALL_MODULES="`grep ^coremodules dev.mk | cut -d"=" -f2` `grep ^warmodules dev.mk | cut -d"=" -f2`"
 
$ for module in $ALL_MODULES; do svn up $module; done
 
 
==== 13) Build rcom modules ====
 
 
Since we have rcom-all and all its sub modules ready, it is pretty simple to build rcom sub modules.
 
Here we build the most common two modules: rcom-admin and rcom-us.
 
$ cd ~/workspace/rcom/rcom-all
 
<font color="red">TODO: the rcom-mobile-core has some problem . Delete the rcom-mobile-core in "coremodules=" list in dev.mk</font>
 
$ make clean &amp;&amp; make package warmodules="rcom-admin rcom-betaus"
 
 
After build finishes, you should have the following files
 
~/workspace/rcom/rcom-all/rcom-admin/rcom-admin-dist.tgz
 
~/workspace/rcom/rcom-all/rcom-betaus/rcom-betaus-dist.tgz
 
 
====14) Deploy rcom-admin to tomcat-cms - <font color='red'>'''TODO'''</font>====
 
<font color='red'>
 
* Deploy properties files
 
* Deploy rcom-admin app (war)
 
</font>
 
 
First let's stop tomcat-cms and do some cleaning
 
$ sudo /etc/init.d/tomcat-cms stop
 
$ sudo rm -rf /rt/tomcat/cms/webapps/rcom-admin*
 
 
Since we cannot auto generate properties files on our desktop,
 
I have pre-built the necessary properties files which works in our env.
 
$ cd ~/Download
 
$ wget <nowiki>http://10.35.59.233/tomcat-cms-props-dev.tgz</nowiki>
 
$ sudo tar xzf tomcat-cms-props-dev.tgz -C /rt/properties
 
$ sudo chown root.rcom /rt/properties/*
 
$ sudo chmod 644 /rt/properties/*
 
 
Now copy the war file to tomcat-cms
 
$ sudo cp ~/workspace/rcom/rcom-all/rcom-admin/rcom-admin.war /rt/tomcat/cms/webapps/
 
$ sudo chown rcomcms.rcom /rt/tomcat/cms/webapps/rcom-admin.war
 
 
Prepare the log directory for rcom-admin
 
$ sudo mkdir -p /rt/logs/cmsadmin
 
$ sudo chown -R rcomcms.rcom /rt/logs/cmsadmin
 
 
Now we can start tomcat-cms, it will extract rcom-admin.war automatically
 
$ sudo /etc/init.d/tomcat-cms start
 
 
Check log files, see if there's any error in them. If there is, ask help from others
 
$ vi /rt/tomcat/cms/logs/catalina.out
 
$ vi /rt/logs/cmsadmin/rcom-admin.log
 
$ vi /rt/logs/cmsadmin/root.log
 
 
Now make sure httpd is running and start it if not
 
$ sudo /etc/init.d/httpd status
 
$ sudo /etc/init.d/httpd start
 
 
If everything is ok, you should be able to access http://your_ip:23900/rcom-admin
 
See the login page, right? wait, you don't have an account? Try this: fliu-cn/fl1u
 
 
===4. How to set up RCOM projects in Eclipse===
 
This is a pretty simple way to set up the RCOM projects in Eclipse, and you can switch to different edition easily.
 
Let's take the i24 as an example:
 
 
 
'''Since you have copied all svn modules from our staging box and updated it, you don't really have to check it out again from svn, so usually you can start from step 4.'''
 
{| border="1" cellspacing="0" cellpadding="5" align="center"
 
! No
 
! Steps
 
! Command in terminal
 
|-
 
| 1
 
| Go to /home/${username}/workspace, ${username} is your current linux user.
 
| cd /home/${username}/workspace
 
|-
 
| 2
 
| check out module rcom-all to your workspace directory.
 
| svn co http://10.90.0.160/svn/rcom-all/branches/i38 rcom-all-i38
 
|-
 
| 3
 
| Navigate to /home/${username}/workspace/rcom-all-i38
 
| cd /home/${username}/workspace/rcom-all-i38
 
|-
 
| 4
 
| Install initial project environment, it will check out all the related modules from SVN, actually it will not take so much time, and it will only run one time in each iteration.
 
| make bootstrap
 
|-
 
| 5
 
| Switch application to rcom-us, following jobs will be done automatically: <br/>1) Checkout or update the latest revision from SVN for module. <br/>2) Make rcom-us as the primary edition which can be debugged in eclipse. <br/>3) Generate the .classpath file for the project.
 
| sudo make switch app=rcom-${edition}<br/> ''(such as us, uk, jp, cn, admin, etc.)''
 
|-
 
| 6
 
| Stop tomcat-cms
 
| sudo /etc/init.d/tomcat-cms hardstop
 
|-
 
| 7
 
| Create context file /rt/tomcat/cms/conf/Catalina/localhost/rcom-${edition}.xml
 
| sudo make context app=rcom-${edition} CATALINA_BASE=/rt/tomcat/cms
 
|-
 
| 8
 
| Grant privileges on rcom-all to ${username}
 
| sudo chown -R ${username}:${username} /home/${username}/workspace/rcom-all-i24
 
|-
 
| 9
 
| Start eclipse and use /home/${username}/workspace as the default workspace
 
|
 
|-
 
| 10
 
| Compile rcom-{edition} by eclipse
 
| (''This step is not doing in terminal, but in eclipse IDE.''). <br/>If there is one compile error, something like "the directory of /WEB-INF/classes is not exists", then just create this folder.
 
File-->Import-->General-->Existing Projects into Workspace -->(select rcom-all)
 
|-
 
| 11
 
| Eclipse will compile and package resources for rcom-${edition} into /home/${username}/workspace/
 
rcom-all/target/rcom-${edition}.
 
We must make it mapped to the "docBase" specified in the file /rt/tomcat/cms/conf/Catalina/localhost/rcom-${edition}.xml
 
| sudo rm -rf /target<br/>ln -s /home/${username}/workspace/rcom-all-24/target /target
 
|-
 
| 12
 
| Start tomcat-cms
 
| sudo /etc/init.d/tomcat-cms hardstart
 
|-
 
| 13
 
| Check whether rcom-${edition} is available.<br/> Open a web browser, input http://localhost:23863/rcom-${edition}, and make sure what you get is not an error page.<br/> You need to modify the port to your
 
|
 
|-
 
| 14
 
| '''If you need to work with other editions like rcom-uk, rcom-jp or rcom-admin application, just repeat steps from No 5) to No 8)'''.
 
|
 
|-
 
| 15
 
| '''CAUTION: There is no static content when you access tomcat directly.'''.
 
|
 
|}
 

Latest revision as of 12:55, 19 October 2017

How to set up development environment (Desktop Linux Fedora18 x64)[]

enable sudo to your account[]

shell> su
shell> chmod +w /etc/sudoers
shell> echo '${username} ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
shell> chmod -w /etc/sudoers
shell> exit

disable SELINUX[]

sudo vi /etc/selinux/config
SELINUX=disabled

set yum proxy[]

shell> sudo vi /etc/yum.conf
#add correct proxy for your env
proxy=http://10.90.7.56:3130/

install synergy[]

  1. use synergy share your keyboard, and mouse between machine
shell>sudo yum install synergy
shell>mkdir ~/synergy
##put synergy.conf and synergy server and client shell under this folder
##you may need synergy official site to write the shell and conf
  1. you may need stop firewall to use synergy, you can add below to your ~/.bash_profile
sudo systemctl stop firewalld.service

install m4[]

shell>sudo yum install m4

install subversion[]

shell>sudo yum install subversion

install git[]

shell>sudo yum install git
  • Todo: add config git proxy

ssh keygen[]

[iphone@bjsit1iphonedev01 .ssh]$ssh-keygen -t rsa

install memcached[]

shell>sudo yum install memcached
  • start memcached
shell>sudo systemctl start memcached.service


install eclipse[]

shell>mkdir -p ~/dev
#put eclipse to ~/dev/, such as ~/dev/eclipse-kepler

You probably want to increase the min/max memory for eclipse, I use "-Xms768m" and "-Xmx1024m"

$ vi ~/eclipse/eclipse.ini

Config eclipse proxy 10.90.7.56:3130
Preferences --> General --> Network Connect

Install subclipse from Eclipse Marketplace
Help --> Eclipse Marketplace , then search your plugin and install

install maven[]

maven install on

/usr/local/maven-2.2.1
/usr/local/maven-3.0.5

and create softlink

[yufei@localhost bin]$ sudo ln -s /usr/local/maven-2.2.1/bin/mvn mvn
[yufei@localhost bin]$ sudo ln -s /usr/local/maven-3.0.5/bin/mvn mvn3

add custon alias[]

  • add custom alias to fe18, add shell file to /etc/profile.d/ , such as : yufei_alias.sh
[yufei@localhost profile.d]$ pwd
/etc/profile.d
[yufei@localhost profile.d]$ cat yufei_alias.sh 
alias jumprcom='ssh jump@10.90.7.23'
alias jumpagency='ssh appdev@10.90.7.23'