Categories
-
Recent Posts
- Configure CentOS Firewall From Command Line
- Add CentOS Package From Command Line
- Consume Web Service With Ruby
- Develop Web Service With Ruby on Rails
- Restore MySQL Database
- Install Ruby 1.8.5, Rails, FastCGI on OpenBSD 4.1
- Install MySQL 5.0 on OpenBSD 4.1
- Install Lighttp 1.4 w/ FastCGI on OpenBSD 4.1
- Quick UNIX Reference
- Backup File Using Amazon S3 And Ruby 1.8.4
- Backup MySQL Database
- Install WordPress on OpenBSD 4.0
- Make An ISO File From a CD in UNIX/Linux
- Install/Configure VMWare Server on CentOS
- Update All CentOS Packages From Command Line
Author Archives: Chris Koehler
Add CentOS Package From Command Line
Install Package By Calling YUM With Install
yum install gcc
Posted in CentOS Comments closed
Consume Web Service With Ruby
require ’soap/wsdlDriver’
Setup The SOAP Driver Using The WSDL URI
wsdlUri = ‘<WSDL URI>’
driver = SOAP::WSDLDriverFactory.new(wsdlUri).create_rpc_driver
Invoke Web Service Method
puts driver.<method name>().to_s
Posted in Ruby, Web Services Leave a comment
Develop Web Service With Ruby on Rails
Create API /app/apis/<object name>.rb
class <object name>Api < ActionWebService::API::Base
api_method :<method name>,
:expects => [{:<parameter 1 name> => :string}, {:<parameter 2 name> => :string}],
:returns => [:string]
end
Create Controller /app/controllers/<object name>_controller.rb
class <object name>Controller < ApplicationController
def <method name>(<parameter 1 name>, <parameter 2 name>)
Code Here
end
end
Posted in Rails, Ruby, Web Services Leave a comment
Restore MySQL Database
Quick Way to Restore a MySQL Databse
mysql -p <database> < <dump file>
Posted in MySQL Leave a comment
Install Ruby 1.8.5, Rails, FastCGI on OpenBSD 4.1
Install Ruby
pkg_add -v ftp://ftp.openbsd.org/pub/OpenBSD/4.1/packages/i386/ruby-1.8.5p6.tgz
Install Gems
pkg_add -v ftp://ftp.openbsd.org/pub/OpenBSD/4.1/packages/i386/ruby-gems-0.9.0.tgz
Install Rails And FCGI
gem install rails
gem install fcgi
Posted in 4.1, FastCGI, Rails, Ruby Leave a comment
Install MySQL 5.0 on OpenBSD 4.1
Install Package
pkg_add -v ftp://ftp.openbsd.org/pub/OpenBSD/4.1/packages/i386/mysql-server-5.0.33.tgz
Install Default Database
/usr/local/bin/mysql_install_db
Start Service And Set Root Password
/usr/local/bin/mysqld_safe &
/usr/local/bin/mysqladmin -u root password ‘<password>’
Start Daemon on Server Startup, Add to /etc/rc.local
if [ -x /usr/local/bin/mysqld_safe ]; then
echo ‘MySQL’
/usr/local/bin/mysqld_safe &
fi
Posted in 4.1, MySQL Leave a comment
Install Lighttp 1.4 w/ FastCGI on OpenBSD 4.1
Install Packages
pkg_add -v ftp://ftp.openbsd.org/pub/OpenBSD/4.1/packages/i386/fcgi-2.4.0p2.tgz
pkg_add -v ftp://ftp.openbsd.org/pub/OpenBSD/4.1/packages/i386/lighttpd-1.4.13p2-mysql.tgz
Example /etc/lighttpd.conf For PHP
$HTTP["host"] == “www.<example>.com” {
server.document-root = “/www/sites/<example>.com/www/”
index-file.names = ( “index.php” )
server.error-handler-404 = “/index.php”
fastcgi.server = ( “.php” =>
( “localhost” =>
(
”socket” => “/tmp/php-fastcgi.socket”,
”bin-path” => “/usr/local/bin/php-fcgi”
)
)
)
}
Example /etc/lighttpd.conf For Ruby on Rails
$HTTP["host"] == “www.<example>.com” {
server.indexfiles [...]
Quick UNIX Reference
Secure Copy
scp <source file> <remote user>@<remote server>:<target file>
TAR And GZIP a Directory Into Single File
tar -czf /<output file name>.tar.gz /<input directory>
Extract Contents Of a TAR.GZ File
tar -xzf /<input file name>.tar.gz
Check Disk Usage
df
Posted in Linux, Unix Leave a comment
Backup File Using Amazon S3 And Ruby 1.8.4
require ‘rubygems’
require ‘aws/s3′
# Setup Connection
AWS::S3::Base.establish_connection!(
:access_key_id => ‘<access key>’,
:secret_access_key => ‘<secret key>’
)
# Initialize Variables
bucket_name = ‘<bucket name>’
file = ‘<file path>’
timestamp = Time.now.strftime(’%Y%m%d%H%M’)
# Setup Bucket And Save File
AWS::S3::Bucket.create(bucket_name)
AWS::S3::S3Object.store(timestamp + file, open(file), bucket_name)
# List Contents of Bucket
AWS::S3::Bucket.find(bucket_name).each do |current_object|
puts current_object.key
end
Posted in Ruby, S3 Leave a comment
Configure CentOS Firewall From Command Line