Tuesday, July 8, 2014

Install Laravel 4 On Ubuntu

http://futuretophp.blogspot.com/2013/05/install-laravel-4-on-ubuntu.html
http://laravel.io/forum/05-25-2014-installing-laravel-on-Ubuntu
http://askubuntu.com/questions/48362/how-to-enable-mod-rewrite-in-apache

https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-14-04-lts
http://laravel.com/docs/installation

Install Laravel 4 On Ubuntu



Recently i willing to learn laravel framework because of its rich features towards web development and that borrows a lot from Rails.In previous i have used the CodeIgniter for my projects.

This post is mainly for beginners, To Install laravel 4 on ubuntu 12.04

Installing Composer:

To install composer via terminal , type the command

# sudo curl -sS https://getcomposer.org/installer | php

Move the composer to usr/local/bin to access composer globally

# sudo mv composer.phar /usr/local/bin/composer
check if the composer is available globally by simply type
#  composer

Installing Laravel:

To install laravel via Git Clone repository first you have to install Git on your machine , if Git is installed in your machine then clone Laravel git repository as

# git clone https://github.com/laravel/laravel.git /opt/lampp/htdocs/lara_test1
 here lara_test1 our newly created project directory for installing laravel , To view the files inside the newly created project folder
#  cd  /opt/lampp/htdocs/lara_test1
#  ls
 To install composer to our project directory
#  composer install
while installing composer if the error thrown such as 
               Laravel requires the Mcrypt PHP extension.
 then you have to install the mycript library , for that simply use
# sudo apt-get install php5-mcrypt
and after that again re-install composer , it may fix issues.

And finally  open your web browser and simply go to
  http://localhost/l_test1/public/
 Also , dont forget to change the persmission of folders within app/storage .

 Every thing goes fine, you welcome with laravel's  default message with Logo.


You Have Arrived.



1) Install LAMP
2) install composer and laravel. install here means download. Basic download composer.phar and laravel.phar. mv them to /usr/local/bin. To make them simpler, rename composer.phar  to composer and laravel.phar to laravel.
3) user composer to create laravel project.
sudo composer create-project laravel/laravel /var/www/myproject --prefer-dist
4) cp /etc/apache2/000-default.conf  /etc/apache2/myproject.conf
5) <VirtualHost *:80>
    ServerAdmin myproject.local
    ServerName www.myproject.local
    ServerAlias www.test.com
    DocumentRoot /var/www/myproject
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
6) sudo a2ensite myproject.conf
7) sudo vi /etc/hosts
127.0.0.1   localhost
127.0.1.1   ubuntu
127.0.1.2   myproject.local
8) sudo service apache2 restart
9) sudo chmod 755 app/storage
go to  http://myproject.local/public

Thursday, May 29, 2014

create CA cert in java sun

keytool -import -trustcacerts -alias dshs_ssvwbolyfldtt01.ssv.wa.lcl -file dshs_ssvwbolyfldtt01.ssv.wa.lcl.p7b -keystore dshs_ssvwbolyfldtt01.ssv.wa.lcl.jks
keytool -import -keystore keystore.production  -storepass pinky -file thawte.crt -alias key-alias-in-store

certutil -P SSVWBOLYFLDTT01.ssv.wa.lcl -M -n cert-SSVWBOLYFLDTT01.ssv.wa.lcl -t u,u,u

keytool -genkey -alias key1 -keyalg RSA -keypass password -storepass password -keystore keystore.jks
keytool -export -alias key1 -storepass password -file server.cer -keystore keystore.jks
keytool -import -v -trustcacerts -alias key1 -file server.cer -keystore cacerts.jks -keypass password -storepass password
keytool -import -v -trustcacerts -alias key1 -file server.cer -keystore cacerts.jks -keypass password

keytool -genkey -alias key1 -keyalg RSA -keypass password -storepass password -keystore keystore.jks


how to create a new cert8.db (security db) and key.db (authenticate db)
certutil -N -P  "SSVWBOLYFLDTT01.ssv.wa.lcl" -d

create a self signed cert
create-selfsigned-cert --user=admin --port=8443 --config=SSVWBOLYFLDTT01.ssv.wa.lcl --token=internal --org-unit=CA --locality=en --state=WA --validity=10 --org=DSHS --country=US --server-name=ssvwbolyfldtt01.ssv.wa.lcl --nickname=cert-SSVWBOLYFLDTT01.ssv.wa.lcl-1

delete
delete-cert --user=admin --port=8989  --password-file=admin.pwd --token=internal --config=SSVWBOLYFLDTT01.ssv.wa.lcl cert2
---------------------------------------------------------

wadmin --username=admin
wadmin > reset-admin-password

in admin console, you can 
1) create a cert through reqest.
2) create a CA file and send it to a CA
3) modify the http-listener to attach to a port or set SSL
4) A very import step, to deploy your configuration change.
5) create a virtual server will automatically create a alias folder (virtual directory) and a service.

Friday, May 16, 2014

Configuration jboss 7

quoted from

http://opensourcearchitect.co/tutorials/ip-addresses-interfaces-jboss-eap6-as7


Configuration through the cli:
Your JBoss AS 7 or EAP 6 server must be started before in order to access the administration console.

Configuring the Default Public Interface:

First we connect to the cli by using the jboss-cli.bat or jboss-cli.sh scripts depending on your operating system:
Step 1:
Windows:
jboss-cli.bat connect
Linux:
$ ./jboss-cli.sh connect
Step 2:
Next we update the interface by issuing the following cli command:
/interface=public:write-attribute(name=inet-address,value=192.168.1.67)
Step 3:
Lastly, we can confirm the updates by viewing the following output:
{
“outcome” => “success”,
“response-headers” => {
“operation-requires-reload” => true,
“process-state” => “reload-required”
}
}
A successful restart of the server will result in the following message printed out in the console and log file:
13:13:09,397 INFO  [org.apache.coyote.http11.Http11Protocol] (MSC service thread 1-15) Starting Coyote HTTP/1.1 on http–192.168.1.67-8080
This will allow you to successfully access your application on the public interface by typing in:
http://{youripaddress}:8080/myapp
For our example, the url will be:
http://192.168.1.67:8080/myapp

Configuring the new Administration Interface:

Step 1:
First we connect to the cli by using the jboss-cli.bat or jboss-cli.sh scripts depending on your operating system:
Windows:
jboss-cli.bat connect
Linux:
$ ./jboss-cli.sh connect
Step 2:
Next we update the administrative interface by issuing the following cli command:
/interface=management:write-attribute(name=inet-address,value=192.168.1.67)
Step 3:
Lastly, we can confirm the updates by viewing the following output:
{
“outcome” => “success”,
“response-headers” => {
“operation-requires-reload” => true,
“process-state” => “reload-required”
}
}
A successful startup will result in the following message printed out in the console and log file:
13:31:00,880 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://192.168.1.67:9990
This will allow you to successfully access the administration console on the administration interface by typing the following in the address bar of your browser:
http://{youripaddress}:9990
For our example, the url will be:
http://192.168.1.67:9990

Configuration through xml files:

In JBoss AS 7, interfaces can be configured in the standalone.xml or domain.xml for a JBoss server.
For example, if we have server installed under:
/home/opensourcearchitect/jboss-as-7.1.1.Final/
The standalone.xml file will be located under:
/home/opensourcearchitect/jboss-as-7.1.1.Final/standalone/standalone.xml
In the standalone.xml file for example you will see:
<interfaces>
<interface name=”management”>
<inet-address value=”127.0.0.1″/>
</interface>
<interface name=”public”>
<inet-address value=”127.0.0.1″/>
</interface>
</interfaces>
This defines the public interface (interface name=”public”) as 127.0.0.1 and the management interface as 127.0.0.1.

Configuring the Default Public Interface:

Step 1:
Edit the standalone.xml file in your favorite text editor.
Step 2:
Next, update the following section:
From:
<interface name=”public”>
<inet-address value=”127.0.0.1″/>
</interface>
To:
<interface name=”public”>
<inet-address value=”{youripaddress}”/>
</interface>
For our example, the ip address will be:
<interface name=”public”>
<inet-address value=”192.168.1.67″/>
</interface>
A successful restart of the server will result in the following message printed out in the console and log file:
13:13:09,397 INFO  [org.apache.coyote.http11.Http11Protocol] (MSC service thread 1-15) Starting Coyote HTTP/1.1 on http–192.168.1.67-8080
This will allow you to successfully access your application on the public interface by typing in:
http://{youripaddress}:8080/myapp
For our example, the url will be:
http://192.168.1.67:8080/myapp

Configuring the new Administration Interface:

Step 1:
Edit the standalone.xml file in your favorite text editor.
Step 2:
Next, update the following section:
From:
<interface name=”management”>
<inet-address value=”127.0.0.1″/>
</interface>
To:
<interface name=”management”>
<inet-address value=”{youripaddress}”/>
</interface>
For our example, the ip address will be:
<interface name=”management”>
<inet-address value=”192.168.1.67″/>
</interface>
A successful startup will result in the following message printed out in the console and log file:
13:31:00,880 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://192.168.1.67:9990
This will allow you to successfully access the administration console on the administration interface by typing the following in the address bar of your browser:
http://{youripaddress}:9990
For our example, the url will be:
http://192.168.1.67:9990

how to install ssl in Sun web server 7

\WebServer7\yourconfigfolder\config\yourconfigure.conf
enable or disable ssl
change the port
...

<http-listener>
    <name>http-listener-1</name>
<!--<ip>198.238.85.241</ip>-->
    <port>80</port>
<!--<port>443</port>-->
    <server-name>SSVWBOLYFLDTT01.ssv.wa.lcl</server-name>
    <default-virtual-server-name>SSVWBOLYFLDTT01.ssv.wa.lcl</default-virtual-server-name>
<!--<ssl>
      <server-cert-nickname>cert1</server-cert-nickname>
    </ssl>-->
</http-listener>

Wednesday, May 14, 2014

run jboss as a windows service

1) Download  jboss-native-2.0.10-windows-x64-ssl.zip and copy the contents of bin catalog to %JBOSS_HOME%/bin

2) Then edit  the service.bat. Below is content of mine service.bat

---------------------------------------------------------------------------------------------------
@echo off
REM JBoss, the OpenSource webOS
REM
REM Distributable under LGPL license.
REM See terms of license at gnu.org.
REM
REM -------------------------------------------------------------------------
REM JBoss Service Script for Windows
REM -------------------------------------------------------------------------




@if not "%ECHO%" == "" echo %ECHO%
@if "%OS%" == "Windows_NT" setlocal
set DIRNAME=%CD%


REM
REM VERSION, VERSION_MAJOR and VERSION_MINOR are populated
REM during the build with ant filter.
REM
set SVCNAME=JBOSS7Server
set SVCDISP=JBoss Application Server 7.1.1_Final
set SVCDESC=JBoss Application Server 7.1.1 Platform: Windows x64
set NOPAUSE=Y


REM Suppress killing service on logoff event
REM set JAVA_OPTS=-Xrs


REM Figure out the running mode


if /I "%1" == "install"   goto cmdInstall
if /I "%1" == "uninstall" goto cmdUninstall
if /I "%1" == "start"     goto cmdStart
if /I "%1" == "stop"      goto cmdStop
if /I "%1" == "restart"   goto cmdRestart
if /I "%1" == "signal"    goto cmdSignal
echo Usage: service install^|uninstall^|start^|stop^|restart^|signal
goto cmdEnd


REM jbosssvc retun values
REM ERR_RET_USAGE           1
REM ERR_RET_VERSION         2
REM ERR_RET_INSTALL         3
REM ERR_RET_REMOVE          4
REM ERR_RET_PARAMS          5
REM ERR_RET_MODE            6


:errExplain
if errorlevel 1 echo Invalid command line parameters
if errorlevel 2 echo Failed installing %SVCDISP%
if errorlevel 4 echo Failed removing %SVCDISP%
if errorlevel 6 echo Unknown service mode for %SVCDISP%
goto cmdEnd


:cmdInstall
jbosssvc.exe -imwdc %SVCNAME% "%DIRNAME%" "%SVCDISP%" "%SVCDESC%" service.bat
if not errorlevel 0 goto errExplain
echo Service %SVCDISP% installed
goto cmdEnd


:cmdUninstall
jbosssvc.exe -u %SVCNAME%
if not errorlevel 0 goto errExplain
echo Service %SVCDISP% removed
goto cmdEnd


:cmdStart
REM Executed on service start
del .r.lock 2>&1 | findstr /C:"being used" > nul
if not errorlevel 1 (
  echo Could not continue. Locking file already in use.
  goto cmdEnd
)
echo Y > .r.lock
jbosssvc.exe -p 1 "Starting %SVCDISP%" > standalone.log (if your log file is located a particular folder, spell it out. ex.  C:\opt\jboss7\standalone\log\standalone.log)
call standalone.bat --server-config=standalone.xml < .r.lock >> standalone.log 2>&1
jbosssvc.exe -p 1 "Shutdown %SVCDISP% service" >> standalone.log
del .r.lock
goto cmdEnd


:cmdStop
REM Executed on service stop
echo Y > .s.lock
jbosssvc.exe -p 1 "Shutting down %SVCDISP%" > shutdown.log
call jboss-cli.bat --connect command=:shutdown >> shutdown.log 2>&1
jbosssvc.exe -p 1 "Shutdown %SVCDISP% service" >> shutdown.log
del .s.lock
goto cmdEnd


:cmdRestart
REM Executed manually from command line
REM Note: We can only stop and start
echo Y > .s.lock
jbosssvc.exe -p 1 "Shutting down %SVCDISP%" >> shutdown.log
call jboss-cli.bat --connect command=:shutdown >> shutdown.log 2>&1
del .s.lock
:waitRun
REM Delete lock file
del .r.lock > nul 2>&1
REM Wait one second if lock file exist
jbosssvc.exe -s 1
if exist ".r.lock" goto waitRun
echo Y > .r.lock
jbosssvc.exe -p 1 "Restarting %SVCDISP%" >> standalone.log
call standalone.bat --server-config=standalone.xml < .r.lock >> standalone.log 2>&1
jbosssvc.exe -p 1 "Shutdown %SVCDISP% service" >> standalone.log
del .r.lock
goto cmdEnd


:cmdSignal
REM Send signal to the service.
REM Requires jbosssch.dll to be loaded in JVM
@if not ""%2"" == """" goto execSignal
echo Missing signal parameter.
echo Usage: service signal [0...9]
goto cmdEnd
:execSignal
jbosssvc.exe -k%2 %SVCNAME%
goto cmdEnd


:cmdEnd
---------------------------------------------------------------------------------------------------


3) Then run service.bat install  from  %JBOSS_HOME%/bin

4) To delete a service
    sc -delete JBOSS7Server ( a service name not id)




Monday, May 12, 2014

create an external property.

svn propset svn:externals 'lib http://plugins.svn.wordpress.org/trunk/externallib'
property 'svn:externals' set on '.'

lib is your local path.

Wednesday, March 12, 2014

transformation in TSF build

Add a publish folder in solution. Add sub folders under publish folder to hold transformed web.config. Put a blank web.config in the sub folders as a placeholder. Make sure the placeholder web.config is set "Do not copy" and "Content" in the property window and is used to pushed to TFS. The build parameters (TransformDEVConfigFile='true' or 'falsedetermine which transformed will be copied to the root. 

In project file, Add following section. First add build project from 2010.  
<!-- ***** SECTION BELOW ADDED IN ORDER TO USE WEB.CONFIG TRANSFORMS ***** -->
<UsingTask TaskName="TransformXml" AssemblyFile="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.Tasks.dll" />
  <!-- TRANSFORMS WEB.CONFIG FROM WEB.DEV.CONFIG -->
  <Target Name="TransformDEVConfigFile" AfterTargets="AfterBuild" Condition="'$(TransformDEVConfigFile)'=='true'">
    <ItemGroup>
      <DeleteAfterBuild Include="$(WebProjectOutputDir)\Publish\DEV\Web.*.config" />
    </ItemGroup>
    <!-- ProjectConfigTransformDEVFileName IS A MSBUILD PARAMETER IN THE BUILD DEFINITION -->
    <TransformXml Source="Web.config" Transform="$(ProjectConfigTransformDEVFileName)" Destination="$(WebProjectOutputDir)\Publish\DEV\Web.config" />
    <Copy SourceFiles="$(WebProjectOutputDir)\Publish\DEV\Web.config" DestinationFolder="$(WebProjectOutputDir)"></Copy>
    <Delete Files="@(DeleteAfterBuild)" />
  </Target>
  <!-- TRANSFORMS WEB.CONFIG FROM WEB.QA.CONFIG -->
  <Target Name="TransformQAConfigFile" AfterTargets="AfterBuild" Condition="'$(TransformQAConfigFile)'=='true'">
    <ItemGroup>
      <DeleteAfterBuild Include="$(WebProjectOutputDir)\Publish\QA\Web.*.config" />
    </ItemGroup>
    <!-- ProjectConfigTransformQAFileName IS A MSBUILD PARAMETER IN THE BUILD DEFINITION -->
    <TransformXml Source="Web.config" Transform="$(ProjectConfigTransformQAFileName)" Destination="$(WebProjectOutputDir)\Publish\QA\Web.config" />
    <Delete Files="@(DeleteAfterBuild)" />
  </Target>
  <!-- TRANSFORMS WEB.CONFIG FROM WEB.PROD.CONFIG -->
  <Target Name="TransformPRODConfigFile" AfterTargets="AfterBuild" Condition="'$(TransformPRODConfigFile)'=='true'">
    <ItemGroup>
      <DeleteAfterBuild Include="$(WebProjectOutputDir)\Publish\PROD\Web.*.config" />
    </ItemGroup>
    <!-- ProjectConfigTransformPRODFileName IS A MSBUILD PARAMETER IN THE BUILD DEFINITION -->
    <TransformXml Source="Web.config" Transform="$(ProjectConfigTransformPRODFileName)" Destination="$(WebProjectOutputDir)\Publish\PROD\Web.config" />
    <Delete Files="@(DeleteAfterBuild)" />
  </Target>

In Web.config, the connectionStrings section will be replace in the transformation web config  
<connectionStrings> <add name="VentureEntities" connectionString="metadata=res://*/Models.VentureModel.csdl|res://*/Models.VentureModel.ssdl|res://*/Models.VentureModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=yoursqlserver; initial catalog=yourdatabase; integrated security=True;multipleactiveresultsets=True;application name=EntityFramework&quot;" providerName="System.Data.EntityClient" /> </connectionStrings>

In Web.DEV.config, the connectionStrings will replace the one in web.config
<connectionStrings xdt:Transform="Replace"> <add name="VentureEntities"     connectionString="metadata=res://*/Models.VentureModel.csdl|res://*/Models.VentureModel.ssdl|res://*/Models.VentureModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=yourDEVsqlserver; initial catalog=yourDEVdatabase; integrated security=True;multipleactiveresultsets=True;application name=EntityFramework&quot;" 
providerName="System.Data.EntityClient" /></connectionStrings>

In Process->Build process paraemters->Advanced
Add /p:TransformDEVConfigFile=true /p:TransformQAConfigFile=true /p:TransformPRODConfigFile=false /p:ProjectConfigTransformDEVFileName="Web.DEV.config" /p:ProjectConfigTransformQAFileName="Web.QA.config" /p:ProjectConfigTransformPRODFileName="Web.PROD.config"







Retention Policy is set default.