Showing posts with label fedora. Show all posts
Showing posts with label fedora. Show all posts

Saturday, 7 November 2015

Create a bootable USB from an ISO using dd on the Linux command line

Install syslinux, a suite of utilities which ensures the iso image is in SYSLINUX format rather than ISOLINUX

    $ sudo apt-get install syslinux

Convert the iso image to SYSLINUX format

    $ isohybrid /path/image.iso 

Locate the USB device 

    $ lsblk
    sdb         8:16   1   3.8G  0 disk 
    └─sdb1      8:17   1   3.8G  0 part /media/user/usb_disk

Unmount the USB device

    $ sudo umount /dev/sdb1

Ensure it is indeed unmounted

    $ lsblk
    sdb         8:16   1   3.8G  0 disk 
    └─sdb1      8:17   1   3.8G  0 part 

Copy the ISO image onto the USB deisk

    $ sudo dd if=/path/image.iso of=/dev/sdb1

Tuesday, 6 October 2015

Gnome - change default application for text files

xdg-mime query default text/plain
xdg-mime default sublime_text.desktop text/plain

xdg-mime query filetype application/x-shellscript
xdg-mime query default application/x-shellscript

Wednesday, 19 August 2015

Send email from script

Install ssmtp:

    $ sudo apt-get install ssmtp

Edit the ssmtp config file:

    $ sudo vim /etc/ssmtp/ssmtp.conf

Enter this in the file:

root=username@gmail.com
mailhub=smtp.gmail.com:465
rewriteDomain=gmail.com
AuthUser=username
AuthPass=password (create a app-specific password in google accounts)
FromLineOverride=YES
UseTLS=YES

Enter the email address of the person who will receive your email:

    $ ssmtp recepient_name@gmail.com

Now enter this:

To: recipient_name@gmail.com
From: username@gmail.com
Subject: Sent from a terminal!

Your content goes here. Lorem ipsum dolor sit amet, consectetur adipisicing.
(Notice the blank space between the subject and the body.)

To send the email: Ctrl + D

You can also save the text mentioned in Point 5 into a text file and send it using:

    $ ssmtp recipient_name@gmail.com < filename.txt

http://askubuntu.com/questions/12917/how-to-send-mail-from-the-command-line

Tuesday, 2 June 2015

CheckInstall

CheckInstall keeps track of all the files created when installing from source ($ make install), builds a standard binary package and installs it using the system package management software (apt / yum etc), allowing you to later uninstall it

 tar -zxvf source-app.tar.gz;
 cd source/ ;
 ./configure;
 make;
 sudo checkinstall make install;

https://wiki.debian.org/CheckInstall

Wednesday, 16 October 2013

MongoDb on Fedora 19

Install and start server

yum install mongodb-server
systemctl start mongod
systemctl enable mongod
systemctl status mongod

Install client and verify it can connect to the server

yum install mongodb
mongo

You should now be in the mongo shell - test you can save and retrieve an object

db.test.save( { a: 1 } )
db.test.find()

Should display something like this:

{ "_id" : ObjectId("525f2fb01ec8e4af43c529c0"), "a" : 1 }

Wednesday, 2 October 2013

node.js / express.js / yeoman / angular installation on Fedora 19

download the prebuilt binary:
http://nodejs.org/dist/v0.10.20/node-v0.10.20-linux-x64.tar.gz

download and build from source
cd /tmp
wget 
http://nodejs.org/dist/v0.10.20/node-v0.10.20.tar.gz
tar -xf node-v0.10.20-linux-x64.tar.gz
cd node-v0.10.20-linux-x64/

configure, build and install
export PREFIX=/usr/local # or whatever your prefix is
./configure --prefix=$PREFIX
export LINK=g++ # only required if you're building on NFS
make
make install


clean up temporary files
rm -rf /tmp/node-v0.10.20-linux-x64*

add node to your path
export PATH=$PREFIX/bin:$PATH

display node and npm versions
node --version
v0.10.20
npm --version
1.3.11


install express.js
npm install -g express

display express version
express --version
3.4.0


install yeoman
npm install -g yo

install yeoman angular generator
npm install -g generator-angular

create angular app
yo angular app-name

serve angular app
grunt server


Saturday, 17 November 2012

windows/fedora dual boot - update grub2

After kernel updates the grub boot menu will include both the new kernel version and the previous kernel version.

Remove old kernels (keeping 2)


$ yum install yum-utils
$ package-cleanup --oldkernels --count=2



Update grub's boot menu


It's probably a good idea to make a backup of the old grub.cfg file

$ grub2-mkconfig -o /boot/grub2/grub.cfg

This will update the grub config used to load the boot menu.

You can customize the menu order by renaming the 10_* entries in /etc/grub.d/

Customize the boot order:

Find the menu entries:

$ grep ^menuentry /boot/grub2/grub.cfg | cut -d "'" -f2

Set the default menu entry:

$ grub2-set-default 'one-of-the-above-menu-entries'

Check to see if it worked:

$ grub2-editenv list

Saturday, 3 November 2012

mysql


Install the the client and server software

$ sudo yum install mysql
$ sudo yum install mysql-server

start mysql server

$ sudo service mysqld start

automatically start mysql daemon on startup

$ sudo chkconfig --level 2345 mysqld on

set root password

$ mysqladmin -u root password foobar

login to localhost server

$ mysql -u root -p
mysql>

create a new user

mysql> create user 'username'@'localhost' identified by 'password';
mysql> grant all privileges on *.* to 'username'@'localhost' with grant option;

mysql-workbench: admin GUI

$ sudo yum install mysql-workbench

Tutorial on creating a database using mysql-workbench here

Mount NTFS partition in linux

Display available hard disks:
$ sudo fdisk -l

Device Boot  Start    End       Blocks    Id  System
/dev/sda2    206848   307202047 153497600 7   HPFS/NTFS/exFAT

Manually mount:
$ sudo mount -t ntfs-3g -o defaults,user,rw /dev/sda2 /mnt/windows/

Set up auto mounting in /etc/fstab:
add the following line to your /etc/fstab:
/dev/sda2 /mnt/windows/ ntfs-3g defaults,user,rw 0 0






Friday, 12 October 2012

Fedora 17: Squeezebox server 7.7.2

Go to http://www.mysqueezebox.com/ download and select the Linux RPM.

It will automatically be opened with the Software Installer, resolve dependencies and install the required packages.

Nothing is ever that simple though!

The service wasn't started, and attempts to force it to start using systemctl failed too

    $ sudo systemctl start squeezeboxserver.service

Looking in /var/log/messages I found the following:

    squeezeboxserver[3040]: Starting Squeezebox Server: Can't locate Slim/bootstrap.pm in @INC (...details of the $INC path)

I then went to /usr to find all files which had anything with Logitech, Squeezebox or Slim in their path

    $ cd /usr

    $ find . | egrep -i logitec\|squeeze\|slim > /tmp/squeezbox.details

I then searched for the missing file (Slim/bootstrap.pm)

    $ grep bootstrap /tmp/squeezbox.details 
    ./lib/perl5/vendor_perl/Slim/bootstrap.pm

So I created a symbolic link to Slim in one of the directories in the $INC path

    $ sudo ln -sf /usr/lib/perl5/vendor_perl/Slim /usr/lib64/perl5/vendor_perl/Slim

It still failed to start, so I looked back in /var/log/messages

    squeezeboxserver[22941]: Starting Squeezebox Server: Can't locate Digest/MD5.pm in @INC 

Some perl modules were missing, which I installed with Yum

    $ sudo yum install perl-Log-Log4perl perl-CGI perl-YAML-LibYAML

Now the service started

    $ sudo systemctl start squeezeboxserver.service
    $ sudo systemctl status squeezeboxserver.service

squeezeboxserver.service - LSB: Startup script for the Logitech Media Server
 Loaded: loaded (/etc/rc.d/init.d/squeezeboxserver)
 Active: active (running) since Sat, 13 Oct 2012 13:25:40 +1100; 1min 36s ago

I had to open a few ports on my firewall to enable my player to connect (namely 3483 tcp and udp for the player, and 9000 tcp for the web-interface).

    $ system-config-firewall
    Other ports
    Add port 9000, tcp
    Add port 3483, tcp and udp

    Apply

go to localhost:9000 to configure

Fedora 17: Installation

I have an old Core 2 Duo with 1 500GB hard drive and 4 x 2TB hard drives stuffed in a cupboard.

I have created a 6TB software RAID drive from the 4 x 2TB drives, whilst the 500GB drive is the boot device.

Today I installed Fedora 17 with Gnome using the LiveUSB creator tool.

I used these instructions: http://fedoraproject.org/wiki/How_to_create_and_use_Live_USB

I downloaded the LiveUSB creator tool from here: http://fedorahosted.org/liveusb-creator

I downloaded the 64 bit Fedora 17 Desktop Edition with Gnome desktop manager from here: http://fedoraproject.org/en/get-fedora-options

My existing RAID configuration remained intact, and I installed over Fedora 16 I had on the 500GB drive.

The Quick Start guide make it trivial to set up... just follow the instructions on-screen.

Configure Auto-Login

Since I run this headless in a cupboard, I needed to configure it to automatically login.

Again this is trivial - Just go to System Settings - User Accounts - click on the Unlock button to enable changes, and select Auto Login

Friday, 21 September 2012

Using rsync to show progress whilst copying

rsync -r -v --progress -e ssh username@hostname:/source destination 

Mount USB drive by label


$ sudo mount /dev/disk/by-label/volume_name /mnt/mount_point -t auto

Wednesday, 14 December 2011

dynamically linked libraries


ELF file format has an RPATH section where it lists hardcoded paths to search for libraries

You can find the RPATH that an application has:
readelf -d app_name  | grep RPATH

Hardcoding paths into an application is not very elegant. It is better to allow the Linux dynamic linker to locate the libraries for you.

Fedora has /etc/ld.so.conf.d/ which is a folder it searches for library paths. You can add foo-x86_64.conf, and inside put the library path, and ld will search that path whenever it needs to locate libfoo.so

Tuesday, 13 December 2011

Fedora 16: enable core files

/proc/sys/kernel/core_pattern is used to specify a core dumpfile pattern name.
If the first character of the pattern is a '|', the kernel will treat the rest of the pattern as a command to run. The core dump will be written to the standard input of that program instead of to a file.

The default core_pattern is:
|/usr/libexec/abrt-hook-ccpp %s %c %p %u %g %t e

So we instead put core.%p into the file so we get a core file.
echo "core.%p" > /proc/sys/kernel/core_pattern

put ulimit -c unlimited into your .bashrc

Monday, 12 December 2011

Fedora 16: Yum and package management

list installed packages
yum list installed

list available packages (not yet installed)
yum list available

list all packages (installed and available)
yum list all

list all package groups
yum grouplist

list all repost
yum repolist

info on a package
yum info package_name

install a package
yum install package_name

install a package group
yum groupinstall "Group package name"

uninstall a package
yum remove package_name

uninstall a package group

yum groupremove "Group package name"

find installation location of a package
rpm -ql package_name

Monday, 5 December 2011

Fedora 16: yum install c++ programming libraries

sudo yum install

gcc.x86_64
gcc-c++.x86_64
boost.x86_64
boost-devel.x86_64
glibc.x86_64 
glibc-common.x86_64
glibc-debuginfo.x86_64
glibc-debuginfo-common.x86_64
glibc-devel.x86_64
glibc-headers.x86_64
glibc-static.x86_64
glibc-utils.x86_64          

libstdc++.x86_64
libstdc++-devel.x86_64
libstdc++-docs.x86_64
libstdc++-static.x86_64

Saturday, 3 December 2011

Fedora 16: NFS Server

in /etc/exports, add the path you want to share, and the ip addresss or range you want to give access to, followed by some options

/mnt/raid 192.168.1.0/255.255.255.0(rw,no_subtree_check,async)

rw: read-write access
no_subtree_check: speeds up access by turning off the check that the current folder is a subtree in the same volume
async: speeds up access by turning off synchronous acks

start the requisite services

systemctl start rpcbind.service
systemctl start nfs-server.service
systemctl start nfs-lock.service
systemctl start nfs-idmap.service

enable automatic restart
systemctl enable rpcbind.service
systemctl enable nfs-server.service
systemctl enable nfs-lock.service
systemctl enable nfs-idmap.service

display exported directories
showmount --exports

Friday, 2 December 2011

Fedora 16: Install Squeezebox Server

Obtain repository
rpm -Uvh http://repos.slimdevices.com/yum/squeezecenter/squeezecenter-repo-1-6.noarch.rpm

yum install squeezeboxserver

sudo ln -sf /usr/lib/perl5/vendor_perl/Slim /usr/lib64/perl5/vendor_perl/Slim

yum install perl-CPAN
perl -MCPAN -e'install Log::Log4perl'
perl -MCPAN -e'install CGI::Cookie'

for some reason the CGI::Cookie install failed, go into cpan, and force install it
cpan
force install CGI::Cookie

sudo systemctl start squeezeboxserver.service
sudo systemctl status squeezeboxserver.service

configure it - browse to localhost:9000

Wednesday, 30 November 2011

Fedora 16 - enable vnc server

install vnc server
$ sudo yum install tigervnc-server

configure vnc server
$ sudo su
# cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service

edit the configuration to specify the user and set the required geometry
User=steve
ExecStart=/usr/bin/vncserver %i -geometry 2560x1440

# systemctl daemon-reload

set the user's vnc password
# su - steve
# vncpasswd
# exit

launch
# systemctl start vncserver@:1.service

enable for restart
# systemctl enable vncserver@:1.service