Pages - Menu

Showing posts with label ubuntu. Show all posts
Showing posts with label ubuntu. Show all posts

Wednesday, April 24, 2013

Linux user not in the sudoers list anymore or forgot your password?

Crap, that happened to me too =/

I've installed VirtualBox and to use my USB devices I had to add my user to the virtualbox group so I did this:

usermod -G virtualbox gerep

My mistake? I forgot the -a or --append option that according to the manual:

Add the user to the supplementary group(s). Use only with the -G option.

The solution is simple, you need to boot on recovery mode (hold down the Shift key during bootup).

In the list that will show, choose the option revory mode.

In the next list, choose root - Drop to root shell prompt. You need to use your root password and doing this will open command line.

The filesystem is mounted as read-only, so you need to enter the following command to get it to remount as read-write, so the changes will be allowed:

mount -o rw, remount

Now I can change my user group with the same command usermod setting my user back to the sudo group but now with the -a option:

usermod -a -G sudo gerep
Now you can exit the command line, and select the option resume - Resume normal boot.

Note:
In case you forgot your user password do this and you'll be able to set a new password:

passwrd your_username

Friday, November 2, 2012

Another way to fix Apache – "Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName"

Hi fellas!

Don't know why but even with the httdp.conf file configured I was still receiving the error: "Could not realiably...", checked the /etc/hosts and everything was OK.

The solution is pretty simple, just rename the http.conf to fqdn and move it to the conf.d folder

Problem solved.

Adios!

Friday, October 26, 2012

How to fix Apache – "Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName"

Hi fellas!

Just made a fresh install of Apache2 on my Ubuntu, made some changes and trying to restart it

$ sudo servie apache2 restart


Returned this:

* Restarting web server apache2 apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName


To fix it you need to edit the httpd.conf file.

$ sudo gedit /etc/apache2/httpd.conf


The file will be blank, no problem, this is default. Add this:

ServerName localhost


And now restart Apache

$ sudo service apache2 restart


Problem solved.

Adios!

Monday, October 22, 2012

Ruby - Installing gem eventmachine

Hi fellas!

Trying this:

$ gem install eventmachine


Returned me this:

make
compiling ssl.cpp
make: g++: Command not found
make: *** [ssl.o] Error 127

The solution is installing the build-essential package:

$ sudo apt-get install build-essential


Problem solved!

Wednesday, October 10, 2012

PostgreSQL - Set superuser password

Hi fellas!

To set the superuser password just follow these amazing steps and be happy.

First you log as su:

[daniel@inspiron ~]$ su -
Password:
[root@inspiron ~]# su - postgres
-bash-4.1$ psql
psql (8.4.9)
Type "help" for help.

postgres=# \password postgres
Enter new password:
Enter it again:
postgres=# \q
-bash-4.1$


Second:

Finish


Ohhhh my God! You don't have the su password? Chill out and do this:

$ sudo passwd root


And define your su password

If I am allowed to you give a tip, create a user with the same name as the one you use to log in on your computer, for instance, mine is daniel, so I created a user with login and superuser access like:

CREATE ROLE your_beautiful_name LOGIN SUPERUSER;


Of course you don't have to give it a SUPERUSER permission but if you don't give it a LOGIN, guess what, it won't log in.

To check if everything went ok just:

SELECT rolname FROM pg_roles;


Adios!

Thursday, October 4, 2012

Terminal - Divide screen

Hi fellas!
Divide the terminal screen can be handy in some cases and here is how I do it:


sudo apt-get install terminator
For more information: http://www.tenshu.net/p/terminator.html

Some quick tips:


Ctrl + Shift + E: will divide the screen vertically
Ctrl + Shift + O: will divide the screen horizontally
Ctrl + Shift + P: go to previous terminal
Ctrl + Shift + N: go to next terminal
Ctrl + Shift + W: close current terminal
Ctrl + Shift + Q: close terminator
F11: go fullscreen


Adios!

Wednesday, October 3, 2012

Terminal - Start application the background

Hi fellas!

My objective was to make sublime text run from terminal, simple task solved with:

sudo ln -s /opt/SublimeText2/sublime_text /usr/bin/sublime

Now the problem is that when I start it from terminal the process will run in foreground and is not what I was looking for, sad!

The "solution"?

~$ sublime &

The problem?
Close the terminal and the application will also be closed.

The real solution?
~$ nohup sublime &

From nohup documentation:

Run a command immune to hangups, runs the given COMMAND with hangup signals ignored, so that the command can continue running in the background after you log out.

Problem solved.

Monday, October 1, 2012

Ruby - Can't Install Curb

Hi fellas!

When trying to install Curb(0.7.15) with native extensions I got this message:


Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
        /home/daniel/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
checking for curl-config... no
checking for main() in -lcurl... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/home/daniel/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
--with-curl-dir
--without-curl-dir
--with-curl-include
--without-curl-include=${curl-dir}/include
--with-curl-lib
--without-curl-lib=${curl-dir}/lib
--with-curllib
--without-curllib
extconf.rb:23:in `<main>':   Can't find libcurl or curl/curl.h (RuntimeError)
  Try passing --with-curl-dir or --with-curl-lib and --with-curl-include
  options to extconf.

Gem files will remain installed in /home/daniel/.rvm/gems/ruby-1.9.3-p194/gems/curb-0.7.15 for inspection.
Results logged to /home/daniel/.rvm/gems/ruby-1.9.3-p194/gems/curb-0.7.15/ext/gem_make.out
An error occurred while installing curb (0.7.15), and Bundler cannot continue.
Make sure that `gem install curb -v '0.7.15'` succeeds before bundling.

As suggested, I tried to install curb but no success!

The solution?

Install this: libcurl4-gnutls-dev and guess what, problem SOLVED!

On Fedora you do:

$ yum install libcurl -devel.(64 or 32 bit version)



Adios!