Tag Archives: ubuntu

[Ubuntu]Recover MongoDB Data following Unexpected Shutdown

ref. http://docs.mongodb.org/manual/tutorial/recover-data-following-unexpected-shutdown/

log file:
$ tail -f /var/log/mongodb/mongodb.log

mongodb data path:
/var/lib/mongodb/

- 2가지 방법 중에 2번째 방법으로 간단히 복구
1. mongod.lock 파일 삭제:
$ sudo rm /var/lib/mongodb/mongod.lock

2. mongod 를 –repair 옵션으로 복구 시작:
$ sudo mongod –dbpath /var/lib/mongodb –repair
$ sudo chown -R mongodb:mongodb /var/lib/mongodb

3. mongodb 시작:
$ sudo service mongodb start
$ sudo service mongodb status

 

[ubuntu 12.04] reinstall grub

ubuntu server 12.04 를 부팅할 때,
grub prompt 상태에 들어가서
grub> _

더 이상 진행되지 않아 grub를 다시 설치해 문제를 해결했다.

ubuntu CD로 부팅해 복구시스템 모드로 들어가
grub를 설치함.
fdisk 로 부팅 파티션을 확인(*표시: /dev/sda1 *)

# sudo fdisk -l

# sudo mount /dev/sda1 /mnt
# sudo grub-install --boot-directory=/mnt/  /dev/sda

# sudo reboot

 

[Ubuntu] How to Install Java Runtime Environment (JRE) in Ubuntu

참조: http://www.ubuntugeek.com/how-to-install-java-runtime-environment-jre-in-ubuntu.html

== Currently Ubuntu has the following Java packages

sun-java6-bin – Contains the binaries

sun-java6-demo – Contains demos and examples

sun-java6-doc – Contains the documentation

sun-java6-fonts – Contains the Lucida TrueType fonts from the JRE

sun-java6-jdk – Contains the metapackage for the JDK

sun-java6-jre – Contains the metapackage for the JRE

sun-java6-plugin – Contains the plug-in for Mozilla-based browsers

sun-java6-source – Contains source files for the JDK
——–방법 1———–
[Ubuntu 11.04]
$ sudo add-apt-repository “deb http://archive.canonical.com/ natty partner”

$ sudo apt-get update

=== Install JRE
$ sudo apt-get install sun-java6-jre sun-java6-plugin

=== Install JDK
$ sudo apt-get install sun-java6-jdk

——-방법 2———-
== Install JRE on ubuntu 11.04 (Natty) using PPA : http://www.ubuntugeek.com/install-jre-in-ubuntu-11-04-natty-using-ppa.html
참조:

Open the terminal and run the following commands

$ sudo add-apt-repository ppa:ferramroberto/java
$ sudo apt-get update
$ sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts

=== Testing Java Runtime Environment
$ java -version

firefox 검색창에 아래 내용을 입력하고 엔터키를 누르면
Java(TM) Plug-in 을 확인할 수 있음

about:plugins

[WordPress] Image could not be processed. Please go back and try again.

[WordPress] Image could not be processed. Please go back and try again.

참조: http://h3x.no/2011/03/06/wordpress-image-could-not-be-processed-please-go-back-and-try-again

해결책: php5-gd 패키지 설치 후  apache2  재실행
Ubuntu:
$  sudo apt-get install php5-gd
$ sudo /etc/init.d/apache2 restart 

 

[Rails]ERROR execjs – Could not find a JavaScript runtime

$ rails  server

.rvm/gems/ruby-1.9.3-head/gems/execjs-1.2.4/lib/execjs/runtimes.rb:45:in `autodetect’: Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)

—————————————

해결책: Gemfile 에  gem ‘therubyracer’ 를 추가하고
‘ bundle install’  명령을 실행

$ vi Gemfile
 gem ‘therubyracer’

$ bundle install
…..
Installing therubyracer (0.9.3) with native extensions

 

 

우분투나 커널 버전확인 명령어

# 우분투 버전확인
$ cat /etc/issue
Ubuntu 11.04 \n \l

$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=11.04
DISTRIB_CODENAME=natty
DISTRIB_DESCRIPTION=”Ubuntu 11.04″

# 커널 버전과 자세한 정보 표시
uname -a : print  all  information
uname -r : print the kernel release
uname -v : print the kernel version
uname -o : print the operating system

[Ubuntu] Rewriting a Hostname to a Directory

참조: O'Reilly Apache Cookbook Jan. 2008 pdf
Rewriting a Hostname to a Directory
You want requests for

http://bogus.example.com/

to be turned into requests for

http://example.com/bogus/
To do this transparently, without a redirect:

RewriteEngine On
RewriteCond "%{HTTP_HOST}" "^([^.]+)\.example\.com$"
RewriteRule "(.*)" "/%1$1" [PT]
Apache2 module enable:
$ sudo a2enmod rewrite