Blog Archive
-
▼
2010
(79)
-
►
June
(11)
- Protect Web Directories using .htacess
- eth0_rename in ethernet card
- Reset windows password using linux live CD
- IPP printer configuration in windows
- Reinstall WIndows Fax and Picture viewer
- Stream audio in Bluetooth Headset using Dongle
- Convert image files to text
- Configuring exim4 in Ubuntu to use GMail for SMTP
- Change apache2 web directory
- Checking webserver vulnerabilities
-
►
June
(11)
Friday, November 26, 2010
Change Tomcat Default port 8080
2. Now with a text editor you have to open and modify server.xml. Here you have to identify the following line (line 184) and you modify it so that changes from:
<Http10Connector port="8080"
secure="false"
maxThreads="100"
maxSpareThreads="50"
minSpareThreads="10" />
to:
<Http10Connector port="80"
secure="false"
maxThreads="100"
maxSpareThreads="50"
minSpareThreads="10" />
3. Startup the web server and access it now using:
http://localhost/
Install Redmine in windows
Installing Redmine in Windows
First Install Ruby Gems after Installing Ruby
C:\software\Ruby\rubygems-1.3.7>ruby setup.rb
RubyGems 1.3.7 installed
=== 1.3.7 / 2010-05-13
NOTE:
http://rubygems.org is now the default source for downloading gems. You may have sources set via ~/.gemrc, so you should replace
http://gems.rubyforge.org with http://rubygems.org
http://gems.rubyforge.org will continue to work for the forseeable future.
New features:
* `gem` commands
* `gem install` and `gem fetch` now report alternate platforms when a
matching one couldn't be found.
* `gem contents` –prefix is now the default as specified in –help. Bug
#27211 by Mamoru Tasaka.
* `gem fetch` can fetch of old versions again. Bug #27960 by Eric Hankins.
* `gem query` and friends output now lists platforms. Bug #27856 by Greg
Hazel.
* `gem server` now allows specification of multiple gem dirs for
documentation. Bug #27573 by Yuki Sonoda.
* `gem unpack` can unpack gems again. Bug #27872 by Timothy Jones.
* `gem unpack` now unpacks remote gems.
* –user-install is no longer the default. If you really liked it, see
Gem::ConfigFile to learn how to set it by default. (This change was made
in 1.3.6)
* RubyGems now has platform support for IronRuby. Patch #27951 by Will Green.
Bug fixes:
* Require rubygems/custom_require if –disable-gem was set. Bug #27700 by
Roger Pack.
* RubyGems now protects against exceptions being raised by plugins.
* rubygems/builder now requires user_interaction. Ruby Bug #1040 by Phillip
Toland.
* Gem::Dependency support #version_requirements= with a warning. Fix for old
Rails versions. Bug #27868 by Wei Jen Lu.
* Gem::PackageTask depends on the package dir like the other rake package
tasks so dependencies can be hooked up correctly.
——————————————————————————
RubyGems installed the following executables:
C:/setup/Ruby186/bin/gem
Fetch Rails and install
C:\software\ProjectManagement\Ruby\redmine-1.0.0>gem fetch rails -v=2.3.5
Downloaded rails-2.3.5
Install Rails Now
C:\software\ProjectManagement\Ruby\redmine-1.0.0>gem install rails -v=2.3.5
Successfully installed rake-0.8.7
Successfully installed activesupport-2.3.5
Successfully installed activerecord-2.3.5
Successfully installed rack-1.0.1
Successfully installed actionpack-2.3.5
Successfully installed actionmailer-2.3.5
Successfully installed activeresource-2.3.5
Successfully installed rails-2.3.5
8 gems installed
Installing ri documentation for rake-0.8.7…
Installing ri documentation for activesupport-2.3.5…
Installing ri documentation for activerecord-2.3.5…
Installing ri documentation for rack-1.0.1…
Installing ri documentation for actionpack-2.3.5…
Installing ri documentation for actionmailer-2.3.5…
Installing ri documentation for activeresource-2.3.5…
Installing ri documentation for rails-2.3.5…
Installing RDoc documentation for rake-0.8.7…
Installing RDoc documentation for activesupport-2.3.5…
Installing RDoc documentation for activerecord-2.3.5…
Installing RDoc documentation for rack-1.0.1…
Installing RDoc documentation for actionpack-2.3.5…
Installing RDoc documentation for actionmailer-2.3.5…
Installing RDoc documentation for activeresource-2.3.5…
Installing RDoc documentation for rails-2.3.5…
Now Install Rack
C:\software\ProjectManagement\Ruby\redmine-1.0.0>gem install rack -v=1.0.1
Successfully installed rack-1.0.1
1 gem installed
Installing ri documentation for rack-1.0.1…
Installing RDoc documentation for rack-1.0.1…
Generate Session Store
C:\software\ProjectManagement\Ruby\redmine-1.0.0>rake generate_session_store
(in C:/software/ProjectManagement/Ruby/redmine-1.0.0)
If you get error in this process move the redmine folder into C:\software\ProjectManagement\Ruby\bin and run the command it will work
Now Set Rails Environment
C:\software\ProjectManagement\Ruby\redmine-1.0.0>set RAILS_ENV=production
Now run DB Migrate to setup Data
C:\software\ProjectManagement\Ruby\redmine-1.0.0>rake db:migrate
(in C:/software/ProjectManagement/Ruby/redmine-1.0.0)
!!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql.
rake aborted!
no such file to load — mysql
(See full trace by running task with –trace)
Install MySql if you don't have
C:\software\ProjectManagement\Ruby\redmine-1.0.0>gem install mysql
Successfully installed mysql-2.8.1-x86-mingw32
1 gem installed
Installing ri documentation for mysql-2.8.1-x86-mingw32…
No definition for next_result
No definition for field_name
No definition for field_table
No definition for field_def
No definition for field_type
No definition for field_length
No definition for field_max_length
No definition for field_flags
No definition for field_decimals
No definition for time_inspect
No definition for time_to_s
No definition for time_get_year
No definition for time_get_month
No definition for time_get_day
No definition for time_get_hour
No definition for time_get_minute
No definition for time_get_second
No definition for time_get_neg
No definition for time_get_second_part
No definition for time_set_year
No definition for time_set_month
No definition for time_set_day
No definition for time_set_hour
No definition for time_set_minute
No definition for time_set_second
No definition for time_set_neg
No definition for time_set_second_part
No definition for time_equal
No definition for error_errno
No definition for error_sqlstate
Installing RDoc documentation for mysql-2.8.1-x86-mingw32…
No definition for next_result
No definition for field_name
No definition for field_table
No definition for field_def
No definition for field_type
No definition for field_length
No definition for field_max_length
No definition for field_flags
No definition for field_decimals
No definition for time_inspect
No definition for time_to_s
No definition for time_get_year
No definition for time_get_month
No definition for time_get_day
No definition for time_get_hour
No definition for time_get_minute
No definition for time_get_second
No definition for time_get_neg
No definition for time_get_second_part
No definition for time_set_year
No definition for time_set_month
No definition for time_set_day
No definition for time_set_hour
No definition for time_set_minute
No definition for time_set_second
No definition for time_set_neg
No definition for time_set_second_part
No definition for time_equal
No definition for error_errno
No definition for error_sqlstate
C:\software\ProjectManagement\Ruby\redmine-1.0.0>set RAILS_ENV=production
Before Doing this Configure database.yml
For Database Configuration goto redmine\conf and rename database.yml.example to database.yml if you use mysql then it should look like this
production:adapter: mysql
database: redmine_production
host: localhost
username: root
password:
encoding: utf8
Now you should create a database named redmine_production in mysql
C:\software\ProjectManagement\Ruby\redmine-1.0.0>rake db:migrate
(in C:/software/ProjectManagement/Ruby/redmine-1.0.0)
rake aborted!
Access denied for user 'root'@'localhost' (using password: NO)
(See full trace by running task with –trace)
C:\software\ProjectManagement\Ruby\redmine-1.0.0>rake db:migrate
(in C:/software/ProjectManagement/Ruby/redmine-1.0.0)
== Setup: migrating ==========================================================
– create_table("attachments", {:force=>true})
-> 0.2820s
– create_table("auth_sources", {:force=>true})
-> 0.0110s
…………………………………………………………..
== ChangeChangesPathLengthLimit: migrated (0.0610s) ==========================
If you get error like libmysql.dll missing in this stage.find the dll from here and copy it to bin folder of ruby
Now Try to run Mongrel
C:\software\ProjectManagement\Ruby\redmine-1.0.0>mongrel_rails start -p 3000 -e production
'mongrel_rails' is not recognized as an internal or external command,
operable program or batch file.
C:\software\ProjectManagement\Ruby\redmine-1.0.0>gem install mongrel_service
Building native extensions. This could take a while…
ERROR: Error installing mongrel_service:
ERROR: Failed to build gem native extension.
C:/setup/Ruby186/bin/ruby.exe extconf.rb
checking for RegisterServiceCtrlHandlerEx()… no
checking for EnumServicesStatusEx()… no
checking for QueryServiceStatusEx()… no
creating Makefile
make
'make' is not recognized as an internal or external command,
operable program or batch file.
Gem files will remain installed in C:/setup/Ruby186/lib/ruby/gems/1.8/gems/win32-service-0.5.2 for inspection.
Results logged to C:/setup/Ruby186/lib/ruby/gems/1.8/gems/win32-service-0.5.2/gem_make.out
Try to Windows Option
C:\software\ProjectManagement\Ruby\redmine-1.0.0>gem install mongrel_service –platform x86-mswin32
Successfully installed win32-service-0.5.2-x86-mswin32
Successfully installed mongrel_service-0.3.4-x86-mswin32
2 gems installed
Installing ri documentation for win32-service-0.5.2-x86-mswin32…
Installing ri documentation for mongrel_service-0.3.4-x86-mswin32…
Installing RDoc documentation for win32-service-0.5.2-x86-mswin32…
Installing RDoc documentation for mongrel_service-0.3.4-x86-mswin32…
Now Run Redmine
C:\software\ProjectManagement\Ruby\redmine-1.0.0>mongrel_rails start -p 3000 -e production
** Starting Mongrel listening at 0.0.0.0:3000
** Starting Rails with production environment…
C:/software/ProjectManagement/Ruby/redmine-1.0.0/config/../vendor/rails/railties/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#ve
rsion_requirements is deprecated and will be removed on or after August 2010. Use #requirement
** Rails loaded.
** Loading any Rails specific GemPlugins
** Signals ready. INT => stop (no restart).
** Mongrel 1.1.5 available at 0.0.0.0:3000
** Use CTRL-C to stop.
With Apache
Configuring Apache + Mongrel on Windows is not significantly different from *nix.
Essentially, you need to proxy requests coming into Apache to Mongrel. What this boils down to is something like this:
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
ServerName www.myapp.comm
DocumentRoot "C:/web/myapp/public"
ProxyPass / http://www.myapp.com:3000/
ProxyPassReverse / http://www.myapp.com:3000/
ProxyPreserveHost On
Stick this in your httpd.conf (or httpd-vhost.conf if you're including it).
It assumes you're going to run mongrel on port 3000, your Rails root is in C:\web\myapp, and you'll access the app at www.myapp.com.
To run the rails app in production mode:
mongrel_rails start -p 3000 -e production
And away you go (actually mongrel defaults to port 3000 so you could skip -p 3000 if you want).
The main difference is that you cannot daemonize mongrel on Windows (i.e. make it run in the background). Instead you can install it as a service using the mongrel_service gem.
0 down vote
I'm new to RoR and have been attempting the same thing on Windows Server 2008, here are some additional notes on getting mongrel going as a service:
if you get compilation errors when installing mongrel_service:
gem install mongrel_service
try using a binary instead by specifying your platform:
gem install mongrel_service –platform x86-mswin32
Additionally, to actually install the service you need to run this command in your RoR's app directory:
mongrel_rails service::install –name MyApp -e production -p 3001 -a 0.0.0.0
(or to remove: mongrel_rails service::remove –name MyApp)
Then you should be able to start/stop the app "MyApp" in your windows services control panel.
References
http://www.richardnichols.net/2009/09/1-minute-guide-installing-redmine-on-windows/http://www.rvaidya.com/blog/ruby/2009/09/15/step-by-step-quick-installation-of-redmine-svn-on-windows/
http://ashwinrayaprolu.wordpress.com/2010/08/05/installing-redmine-on-windows-for-newbie/
Sunday, November 21, 2010
Remote SQL Express 2008 Network Connections
Enabling Remote SQL Express 2008 Network Connections
1. Open up the SQL Server Configuration Manager. Programs / Microsoft SQL Server 2008 / Configuration Tools / SQL Server Configuration Manager.
2. Expand the SQL Server Network Configuration node and select the Protocols for SQLEXPRESS
3. Enable TCP/IP by right-clicking and selecting Enable, then OK.
4. Click on the SQL Server Services node and in the right panel right-click SQL Server (EXPRESS) and select restart to restart the service.
5. Right-click on the SQL Server Browser and select start to start the browser service if it isn't started already. This will allow you to access the SQL Express instance by the computer name.
6. Open up SQL Server Management Studio as Administrator. (If you don't have SSMS installed, get it here)
7. In the Object Explorer under the Security node, add a new user for the account that will be connecting by right-clicking and selecting "New User". This opens the Login Properties page. If you're on a domain then use Windows Authentication. For my VPC scenario it wasn't connected to a domain so I added a SQL Server login and password. (To enable SQL logins you need to first right-click on the SQL Express instance at the top, select Properties and under Security select "SQL Server and Windows Authentication mode".)
8. Select User Mapping on the Login Properties and check off the database you want to connect to. If you're just testing then you can select db_owner in the role membership to grant all access to the database, including altering the schema. Please note that this is not secure but it works for development and testing.
If you want to be secure you can go and specifically grant permissions under the Security node for the specific database back up in the Object Explorer. But if you're on a domain then I would recommend creating a least privileged Windows Security Group on your domain and adding that to a SQL Server Role that you can configure explicit permissions on (i.e. GRANT EXECUTE on your CRUD stored procs and GRANT SELECT on tables, don't let DELETE, INSERT and UPDATE directly). Then you can just use normal Windows security to add users on the domain to the group. This also lets you use integrated security in the connection strings which is much more secure.
9. Configure the Firewall. This is the step that I forgot and was banging my head on the wall 4-EV-R! Open up Windows Firewall and select Change Settings, select the Exceptions Tab and click Add Program. You'll need to select the SQLServer.exe in Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\Binn\ and the SQLBrowser.exe in Program Files\Microsoft SQL Server\90\Shared\. Then select Properties for each of them and select the "Change Scope" button. Then select the proper scope. For development and testing you could specify the remote computer's IP address or widen it to your network subnet. I recommend not allowing Internet users. ;-)
10. Configure the connection string. Now back in Visual Studio you can configure your connection string settings in your Project Settings (app.config). If you used Windows Authentication then it's really easy:
Data Source=SERVERNAME\sqlexpress;Initial Catalog=MyDatabase;Integrated Security=True
If you used a SQL Login then you need to supply a less secure connection string with the username and password:
Data Source=SERVERNAME\sqlexpress;Initial Catalog=MyDatabase;User ID=username;Password=password
I hope that works for you, it did for me. If you're still having trouble please see these troubleshooting tips in the library or ask a question on the SQL Server forums. I'm by no means an expert in SQL Server configuration or networks.
If you need to set up production environments I'd read the SQL Server Books online.
Thursday, November 4, 2010
Send mail using command
Telnet - SMTP Commands (sending mail using telnet)
- An active internet connection (an embarrasing stage to miss sometimes!)
- The address of a mail server capable of relaying for you - usually provided by your dialup provider (e.g. mail.domain.ext)
- A valid email address (e.g. mail@domain.ext)
telnet mail.domain.ext 25You should receive a reply like:
Trying ???.???.???.???...
Connected to mail.domain.ext.
Escape character is '^]'.
220 mail.domain.ext ESMTP Sendmail ?version-number?; ?date+time+gmtoffset?You will then need to delcare where you are sending the email from:
HELO local.domain.name - dont worry too much about your local domain name although you really should use your exact fully qualified domain name as seen by the outside world the mail server has no choice but to take your word for it as of RFC822-RFC1123.This should give you:
250 mail.domain.ext Hello local.domain.name [loc.al.i.p], pleased to meet youNow give your email address:
(On many mailservers the space after the : is required rather that optional. Thanks to Justing Goldberg)
MAIL FROM: mail@domain.extShould yeild:
250 2.1.0 mail@domain.ext... Sender okNow give the recipients address:
RCPT TO: mail@otherdomain.extShould yeild:
250 2.1.0 mail@otherdomain.ext... Recipient okNote Google mail servers require < and > around the email address (thanks to Paul Beattie).
To start composing the message issue the command
DATAIf you want a subject for your email type
Subject:-type subject here- then press enter twice (these are needed to conform to RFC 882)You may now proceed to type the body of your message (e.g.
hello mail@otherdomain.ext from mail@domain.ext)To tell the mail server that you have completed the message enter a single "
." on a line on it's own.The mail server should reply with:
250 2.0.0 ???????? Message accepted for deliveryYou can close the connection by issuing the
QUIT command.The mailserver should reply with something like:
221 2.0.0 mail.domain.ext closing connection
Connection closed by foreign host.Reference

