Hot answers tagged

174

There are no benefits that I can discern for using CentOS (or RHEL) over Ubuntu if you are equally familiar with using both OSes. We use RHEL and CentOS heavily at work, and it's just painful -- we're building custom packages left and right because the OS doesn't come with them, and paid RedHat support is worse than useless, being chock full of "pillars of ...


110

For the JRE, something like this should do the trick: JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::")


93

Installing PHP 5.4.* on Ubuntu 12.04 Simply add the PPA repository: sudo add-apt-repository ppa:ondrej/php5-oldstable And install it: sudo apt-get update sudo apt-get install php5 You may need to install add-apt-repository on Ubuntu 12.04. To do so, run the command: sudo apt-get install python-software-properties Other New Versions For PHP 5.5 (...


81

You can do a couple of things for avoiding this. Setting the DEBIAN_FRONTEND variable to noninteractive and using -y flag. For example: export DEBIAN_FRONTEND=noninteractive apt-get -y install [packagename] If you need to install it via sudo, use: sudo DEBIAN_FRONTEND=noninteractive apt-get -y install [packagename]


71

Check for the presence of /var/run/reboot-required.


71

just run: ssh-add on the client (your pc)


63

apt-mark can help you: apt-mark auto zlib1g-dev For 11.04 or older, use "markauto" instead of "auto"


63

Based on the date displayed by your version of OpenSSL, it seems you are seeing the full version displayed there. Open SSL 1.0.1 was released on March 14th, 2012. 1.0.1a was released on April 19th of 2012. So, I'm going to go ahead and assert that openssl version -a is the proper, cross-distro way to display the full version of OpenSSL that's installed on ...


61

Apparently, the current method to auto-start Docker containers (from Docker 1.2) is to use restart policies. This will control how Docker should handle starting of the container upon startup and re-starting of the container when it exits. I've used the 'always' option so far, and can confirm that it makes Docker auto-start the container at system boot: sudo ...


59

For our ec2 ubuntu instance, the above answers did not work completely. On Ubuntu, by default, the check is not enabled in the rcS file. So Edit rcS file sudo vi /etc/default/rcS below the line #FSCKFIX=no Add FSCKFIX=yes Then do as suggested above. sudo touch /forcefsck Reboot from ec2 console. Delete the line FSCKFIX=yes to get back rcS ...


57

Short answer: Using visudo, add the following to your sudoers file, replacing username with the proper username: username ALL = /etc/init.d/apache2 If you want to not have to type in a password before you do this, use the following: username ALL = NOPASSWD: /etc/init.d/apache2 After this, the 'username' user can execute sudo /etc/init.d/apache2 ...


57

My problem is not the same as can't type lower cased e in amazon ec2 (Amazon Linux), but similar. After checking /etc/inputrc and finding nothing out of the ordinary, I remembered that I did do some keybinding in the /etc/bash.bashrc. This was already there for a very long time and worked flawlessly, though. Why would it make problems now? I found out ...


56

There are actually three ways you can do this: the right way, the wrong way, and the ugly way. First, create a normal user account. adduser username Then select one of the following: The Right Way Create a sudo entry for the wheel group in /etc/sudoers like this: ## Allows people in group wheel to run all commands %wheel ALL=(ALL) ALL Or ...


54

First stop your server obviously: sudo service apache2 stop Remove apache2 packages and dependencies: sudo apt-get purge apache2 apache2-utils apache2.2-bin apache2-common sudo apt-get autoremove --purge If you manually modified or installed stuff, apt might not remove it. Check what's left: whereis apache2 Have a look whats inside these directories,...


53

You are right, the Ubuntu EC2 EBS images don't come with swap space configured (for 11.04 at least). The "regular" instance-type images do have a swap partition, albeit only 896 MB on the one I tested. If some process blows up and you don't have swap space, your server could come to a crawling halt for a good while before the OOM killer kicks in, whereas ...


53

First of all you should check what websites are hosted on the server # apachectl -t -D DUMP_VHOSTS Then when you will find a site check corresponding configuration file for the option DocumentRoot. For example # apachectl -t -D DUMP_VHOSTS VirtualHost configuration: wildcard NameVirtualHosts and _default_ servers: *:80 is a ...


52

By default Ubuntu doesn't specify a ServerName in the Apache configuration, because it doesn't know what the name of your server is. It tries a reverse lookup on your IP address, which returns nothing, so it just has to use the IP address as the ServerName. To fix it, either add a ServerName directive outside of any virtual host - e.g. in /etc/apache2/...


51

.bash_profile and .bashrc are specific to bash, whereas .profile is read by many shells in the absence of their own shell-specific config files. (.profile was used by the original Bourne shell.) .bash_profile or .profile is read by login shells, along with .bashrc; subshells read only .bashrc. (Between job control and modern windowing systems, .bashrc by ...


49

The command apt-get upgrade will not add or remove packages. apt-get dist-upgrade will add or remove packages as required. The command apt-get dist-upgrade will not automatically upgrade you from one release to another unless you have also updated your sources (/etc/apt/sources.list) to point at a newer release. man apt-get upgrade upgrade is used to ...


47

By default, cron will email the owner of the account under which the crontab is running. The system-wide crontab is in /etc/crontab runs under the user `root' Because root is used widely, I'd recommend adding a root alias to your /etc/aliases file anyways. (run 'newaliases' after) The normal way to structure this is for root to be aliased to another user ...


47

I don't know about "Ubuntu", but in Linux generally, "iptables" isn't a service - it's a command to manipulate the netfilter kernel firewall. You can "disable" (or stop) the firewall by setting the default policies on all standard chains to "ACCEPT", and flushing the rules. iptables -P INPUT ACCEPT iptables -P OUTPUT ACCEPT iptables -P FORWARD ACCEPT ...


45

You need to edit two files: /etc/motd (Message of the Day) /etc/ssh/sshd_config: Change the setting PrintLastLog to "no", this will disable the "Last login" message.


44

I also agree there is a lack of tutorials for people who just need a script to send, e.g. error emails, and don't need a full-blown mail server. First, if postfix not already installed do: sudo apt-get install postfix It prompts with a couple of questions. For the first I chose "Internet site"; for a machine behind a firewall I might choose smarthost ...


44

You can use pre-seeding for this, using the debconf-set-selections command to pre-answer the questions asked by debconf before installing the package. For example: debconf-set-selections <<< "postfix postfix/mailname string your.hostname.com" debconf-set-selections <<< "postfix postfix/main_mailer_type string 'Internet Site'" apt-get ...


44

By default, you can only write to /var/run as a user with an effective user ID of 0 (ie as root). This is for good reasons, so whatever you do, don't go and change the permissions of /var/run... Instead, as root, create a directory under /var/run: # mkdir /var/run/mydaemon Then change its ownership to the user/group under which you wish to run your ...


44

Have you had a look at RNG? Fedora/Rh/Centos types: sudo yum install rng-tools On deb types: sudo apt-get install rng-tools to set it up. Then run sudo rngd -r /dev/urandom before generating the keys. Reference: http://it.toolbox.com/blogs/lim/how-to-generate-enough-entropy-for-gpg-key-generation-process-on-fedora-linux-38022


44

$ sudo apt-get install php5-cli Should do it.


44

I usually do release upgrades over VPN, so I'we tried this a few times. Whenever it updates my openvpn package I loose connection, so I reconnect afterwards and do this: ssh into the box, if SSH does not work there is a backup SSH session on port 1022. Do a sudo screen -list There is a screen on: 2953.ubuntu-release-upgrade-screen-window (09/13/...


44

Yes, Ctrl-aq, should work by default, however no, lxc-console does not actually use screen to accomplish its console behavior. In fact, you might be encountering a conflict if you are using screen since it also uses Ctrl-a as a prefix. If you're inside screen but don't realize it then you'll need to type Ctrl-a a q since the default behavior of screen is ...


44

I had the same problem. All you have to do is add --allow-root to your command. See this issue.



Only top voted, non community-wiki answers of a minimum length are eligible