Contents
mongoDB – under SUSE SLE11 – SP3
Getting started with mongoDB under Suse Linux. Installation:
1
2
3
|
zypper addrepo —no–gpgcheck http://repo.mongodb.org/zypper/suse/11/mongodb-org#
sudo zypper install mongodb–org
vi /etc/mongod.conf
|
Note: Default port is 27017 Starting/Stopping mongoDB server:
1
2
|
sudo service mongod start
sudo service mongod stop
|
Verify server status:
1
|
tail –f /var/log/mongodb/mongod.log
|
Make it part of the autostart for different run levels:
1
|
sudo chkconfig mongod on
|
Getting started with mongoDB
Hide/Show Desktop Icons on SUSE
Sometimes it is desirable to have a clean desktop. The following steps will allow you to achieve that with minimal commands.
1
2
3
4
5
|
– open a terminal
– type gconf–editor
– navigate apps/nautilus/desktop
– Select/De–select the items you want to display on the desktop.
– Exit from there and you are done!
|
LAMP – install on Ubuntu
Easiest way to install LAMP stack on Ubuntu servers
1
2
|
sudo apt–get update
sudo apt–get install lamp–server^
|
Yes the ^ is needed.
dummy sendmail
Lets say you are developing an app that sends mail, but you don’t want to actually send any mails out. The answer for your quest is “dummy sendmail”
1
2
3
4
5
6
7
8
9
|
#!/bin/bash
# replace the /usr/bin/sendail with this shell script.
# Everytime someone sends a mail, the content of the mail will be written to a file under /tmp/mail.20150203.log
TS=`date “+%Y%m%d”`
FN=“/tmp/mail.$TS.log”
cat – >> $FN
echo “=== End Of Message Received ===” >> $FN
|
sudo config
sudo is a standard way to give users some administrative rights without giving out the root password. This can also be configured for non root users as well.
1
2
3
|
vi /etc/sudoers and add the following line
Syntax:
user hosts = (runas) commands
|
1
2
|
# user john is allowed to run some_script.sh as jack with no password
john ALL = (jack) NOPASSWD: /work/some_script.sh
|
1
2
3
|
# Any user part of the opsgrp will be allowed to mount and unmount squashfiles as root with no password.
User_Alias OPSACC = %opsgrp
OPSACC ALL = (root) NOPASSWD: /bin/mount –t squashfs –o loop *, /bin/umount –t squashfs *
|
sftp only access (no shell access)
1
2
|
groupadd sftponly_group
useradd –d /home/sftp_dir/ –g sftponly_group –s /bin/false sftp_user
|
Add the following lines to /etc/ssh/sshd_config
1
2
3
4
5
|
Match Group sftponly_group
ChrootDirectory %h
AllowTcpForwarding no
X11Forwarding no
ForceCommand internal–sftp –l INFO –f AUTH
|
Make sure to restart sshd daemon.
command > some_file.txt 2>&1
What does 2>&1 do in a linux console?
Change the default editor
I ran into this with CentOS 5. Where the default editor for the system is set to nano! I like vi and wanted to change the default to it. login to the system vi .bashrc Add the following two lines to .bashrc
1
2
|
export EDITOR=“vim”
export VISUAL=“vim”
|
run the command, source .bashrc A change to /etc/bashrc will make it a system wide change
Virtualbox dhcp set
1
|
VBoxManage.exe dhcpserver add —ip 10.0.7.1 —netmask 255.255.255.0 —lowerip 10.0.7.2 —upperip 10.0.7.10 —enable —netname intnet
|
Simple all mail relay
You have a server who’s IP is already white listed on your mail server & you wanted this server to pass all outgoing mails to the company’s mail server. This method basically eliminates the need for a mail server to be running on the local box.
1
2
|
– vi /etc/mail.rc and add the following line to it.
set your.valid.mail.com
|