Category Archives: Mac OS X

ffmpeg

./configure --disable-yasm
make
make install

264 is available at ​http://www.videolan.org/developers/x264.html. FFmpeg depends on x264 when compiled with –enable-libx264 and x264 depends on FFmpeg when compiled with –enable-lavf-input. The best way to handle it is to install x264 first without –enable-lavf-input, then compile FFmpeg with –enable-libx264 and finally compile x264 again with –enable-lavf-input.

pdeneef@semarang:~/Projects/media-utils/n2.3# ffmpeg
FFmpeg version SVN-r26402, Copyright (c) 2000-2011 the FFmpeg developers
built on Aug 3 2013 14:56:13 with llvm_gcc 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
configuration: –enable-libmp3lame –enable-shared –disable-mmx –arch=x86_64
libavutil 50.36. 0 / 50.36. 0
libavcore 0.16. 1 / 0.16. 1
libavcodec 52.108. 0 / 52.108. 0
libavformat 52.93. 0 / 52.93. 0
libavdevice 52. 2. 3 / 52. 2. 3
libavfilter 1.74. 0 / 1.74. 0
libswscale 0.12. 0 / 0.12. 0
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]… {[outfile options] outfile}…

Use -h to get full help or, even better, run ‘man ffmpeg’
pdeneef@semarang:~/Projects/media-utils/n2.3# ffmppeg
-bash: ffmppeg: command not found
pdeneef@semarang:~/Projects/media-utils/n2.3# ./ffmpeg
ffmpeg version 2.3 Copyright (c) 2000-2014 the FFmpeg developers
built on Jul 26 2014 10:47:31 with Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
configuration: –disable-yasm
libavutil 52. 92.100 / 52. 92.100
libavcodec 55. 69.100 / 55. 69.100
libavformat 55. 48.100 / 55. 48.100
libavdevice 55. 13.102 / 55. 13.102
libavfilter 4. 11.100 / 4. 11.100
libswscale 2. 6.100 / 2. 6.100
libswresample 0. 19.100 / 0. 19.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]… {[outfile options] outfile}…

Use -h to get full help or, even better, run ‘man ffmpeg’
pdeneef@semarang:~/Projects/media-utils/n2.3#

VMWare Tools installation in VMWare Fusion Oracle Linux on Mac OS X

VMWare Tools installation on VMWare Fusion OEL 6.5 VM.

VMWare Tools helps you copy and paste between Host and Guest.
It also makes Host shares available to Guest.

As root.

Make sure kernel stuff is available.
This is required for host shares to work.

yum -y install kernel-uek-headers-`uname -r`
yum -y install kernel-uek-devel-`uname -r`

VMWare Tools CD probably automounted in /media

 
cd /media
ls
VMware Tools

Copy VMWare Tools

mount -t iso9660 /dev/cdrom /mnt/cdrom 
cp /mnt/cdrom/VMwareTools-9.6.2-1688356.tar.gz .
gunzip VMwareTools-9.6.2-1688356.tar.gz
tar xvf VMwareTools-9.6.2-1688356.tar

Run install script (Perl)

cd vmware-tools-distrib/
perl vmware-install.pl 

Make Host share available in VMWare Fusion -> Settings -> Shares.

Restart Guest

shutdown -r now

Loaded plugins: refresh-packagekit, security
Setting up Install Process
Package kernel-uek-headers-3.8.13-26.2.3.el6uek.x86_64 already installed and latest version
Nothing to do


[root@surabaya vmware-tools-distrib]# yum -y install kernel-uek-devel-`uname -r`
Loaded plugins: refresh-packagekit, security
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package kernel-uek-devel.x86_64 0:3.8.13-26.2.3.el6uek will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=================================================================================================================================================
Package                           Arch                    Version                                Repository                                Size
=================================================================================================================================================
Installing:
kernel-uek-devel                  x86_64                  3.8.13-26.2.3.el6uek                   public_ol6_UEKR3_latest                  8.9 M

Transaction Summary
=================================================================================================================================================
Install       1 Package(s)

Total download size: 8.9 M
Installed size: 32 M
Downloading Packages:
kernel-uek-devel-3.8.13-26.2.3.el6uek.x86_64.rpm                                                                          | 8.9 MB     00:01
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : kernel-uek-devel-3.8.13-26.2.3.el6uek.x86_64                                                                                  1/1
Verifying  : kernel-uek-devel-3.8.13-26.2.3.el6uek.x86_64                                                                                  1/1

Installed:
kernel-uek-devel.x86_64 0:3.8.13-26.2.3.el6uek

Complete!
[root@surabaya vmware-tools-distrib]# perl vmware-install.pl
A previous installation of VMware Tools has been detected.

The previous installation was made by the tar installer (version 4).

Keeping the tar4 installer database format.

You have a version of VMware Tools installed.  Continuing this install will
first uninstall the currently installed version.  Do you wish to continue?
(yes/no) [yes] yes

Uninstalling the tar installation of VMware Tools.

Stopping services for VMware Tools

Stopping VMware Tools services in the virtual machine:
Guest operating system daemon:                          [  OK  ]
VMware User Agent (vmware-user):                        [  OK  ]
Blocking file system:                                   [  OK  ]
Unmounting HGFS shares:                                 [  OK  ]
Guest filesystem driver:                                [  OK  ]

Stopping Thinprint services in the virtual machine:
Stopping Virtual Printing daemon:                                   done

File /etc/pulse/default.pa is backed up to /etc/pulse/default.pa.old.0.

The removal of VMware Tools 9.6.2 build-1688356 for Linux completed
successfully.

Installing VMware Tools.

In which directory do you want to install the binary files?
[/usr/bin]

What is the directory that contains the init directories (rc0.d/ to rc6.d/)?
[/etc/rc.d]

What is the directory that contains the init scripts?
[/etc/rc.d/init.d]

In which directory do you want to install the daemon files?
[/usr/sbin]

In which directory do you want to install the library files?
[/usr/lib/vmware-tools]

The path "/usr/lib/vmware-tools" does not exist currently. This program is
going to create it, including needed parent directories. Is this what you want?
[yes]

In which directory do you want to install the documentation files?
[/usr/share/doc/vmware-tools]

The path "/usr/share/doc/vmware-tools" does not exist currently. This program
is going to create it, including needed parent directories. Is this what you
want? [yes]

The installation of VMware Tools 9.6.2 build-1688356 for Linux completed
successfully. You can decide to remove this software from your system at any
time by invoking the following command: "/usr/bin/vmware-uninstall-tools.pl".

Before running VMware Tools for the first time, you need to configure it by
invoking the following command: "/usr/bin/vmware-config-tools.pl". Do you want
this program to invoke the command for you now? [yes]

Initializing...

Making sure services for VMware Tools are stopped.

Stopping Thinprint services in the virtual machine:
Stopping Virtual Printing daemon:                                   done
Stopping VMware Tools services in the virtual machine:
Guest operating system daemon:                          [  OK  ]
VMware User Agent (vmware-user):                        [  OK  ]
Blocking file system:                                   [  OK  ]
Unmounting HGFS shares:                                 [  OK  ]
Guest filesystem driver:                                [  OK  ]

The module vmci has already been installed on this system by another installer
or package and will not be modified by this installer.

The module vsock has already been installed on this system by another installer
or package and will not be modified by this installer.

The module vmxnet3 has already been installed on this system by another
installer or package and will not be modified by this installer.

Use the flag --clobber-kernel-modules=vmxnet3 to override.

The module pvscsi has already been installed on this system by another
installer or package and will not be modified by this installer.

Use the flag --clobber-kernel-modules=pvscsi to override.

The module vmmemctl has already been installed on this system by another
installer or package and will not be modified by this installer.

Use the flag --clobber-kernel-modules=vmmemctl to override.

The VMware Host-Guest Filesystem allows for shared folders between the host OS
and the guest OS in a Fusion or Workstation virtual environment.  Do you wish
to enable this feature? [yes]

Before you can compile modules, you need to have the following installed...

make
gcc
kernel headers of the running kernel

Searching for GCC...
Detected GCC binary at "/usr/bin/gcc".
The path "/usr/bin/gcc" appears to be a valid path to the gcc binary.
Would you like to change it? [no]

Searching for a valid kernel header path...
Detected the kernel headers at
"/lib/modules/3.8.13-26.2.3.el6uek.x86_64/build/include".
The path "/lib/modules/3.8.13-26.2.3.el6uek.x86_64/build/include" appears to be
a valid path to the 3.8.13-26.2.3.el6uek.x86_64 kernel headers.
Would you like to change it? [no]

Using 2.6.x kernel build system.
make: Map '/tmp/modconfig-jKG9kf/vmhgfs-only' wordt binnengegaan
/usr/bin/make -C /lib/modules/3.8.13-26.2.3.el6uek.x86_64/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. \
MODULEBUILDDIR= modules
make[1]: Map '/usr/src/kernels/3.8.13-26.2.3.el6uek.x86_64' wordt binnengegaan
CC [M]  /tmp/modconfig-jKG9kf/vmhgfs-only/backdoorGcc64.o
CC [M]  /tmp/modconfig-jKG9kf/vmhgfs-only/backdoor.o
CC [M]  /tmp/modconfig-jKG9kf/vmhgfs-only/cpName.o
CC [M]  /tmp/modconfig-jKG9kf/vmhgfs-only/bdhandler.o
CC [M]  /tmp/modconfig-jKG9kf/vmhgfs-only/cpNameLinux.o
CC [M]  /tmp/modconfig-jKG9kf/vmhgfs-only/cpNameLite.o
CC [M]  /tmp/modconfig-jKG9kf/vmhgfs-only/dentry.o
CC [M]  /tmp/modconfig-jKG9kf/vmhgfs-only/dir.o
CC [M]  /tmp/modconfig-jKG9kf/vmhgfs-only/file.o
CC [M]  /tmp/modconfig-jKG9kf/vmhgfs-only/filesystem.o
CC [M]  /tmp/modconfig-jKG9kf/vmhgfs-only/fsutil.o
CC [M]  /tmp/modconfig-jKG9kf/vmhgfs-only/hgfsBd.o
CC [M]  /tmp/modconfig-jKG9kf/vmhgfs-only/hgfsEscape.o
CC [M]  /tmp/modconfig-jKG9kf/vmhgfs-only/hgfsUtil.o
CC [M]  /tmp/modconfig-jKG9kf/vmhgfs-only/inode.o
CC [M]  /tmp/modconfig-jKG9kf/vmhgfs-only/link.o
CC [M]  /tmp/modconfig-jKG9kf/vmhgfs-only/message.o
CC [M]  /tmp/modconfig-jKG9kf/vmhgfs-only/page.o
CC [M]  /tmp/modconfig-jKG9kf/vmhgfs-only/module.o
CC [M]  /tmp/modconfig-jKG9kf/vmhgfs-only/request.o
CC [M]  /tmp/modconfig-jKG9kf/vmhgfs-only/rpcout.o
CC [M]  /tmp/modconfig-jKG9kf/vmhgfs-only/stubs.o
CC [M]  /tmp/modconfig-jKG9kf/vmhgfs-only/super.o
CC [M]  /tmp/modconfig-jKG9kf/vmhgfs-only/transport.o
CC [M]  /tmp/modconfig-jKG9kf/vmhgfs-only/vmci.o
CC [M]  /tmp/modconfig-jKG9kf/vmhgfs-only/kernelStubsLinux.o
SDTSTB  /tmp/modconfig-jKG9kf/vmhgfs-only/vmhgfs.sdtstub.S
AS [M]  /tmp/modconfig-jKG9kf/vmhgfs-only/vmhgfs.sdtstub.o
LD [M]  /tmp/modconfig-jKG9kf/vmhgfs-only/vmhgfs.o
Building modules, stage 2.
MODPOST 1 modules
SDTINF  /tmp/modconfig-jKG9kf/vmhgfs-only/vmhgfs.sdtinfo.c
CTF
CC      /tmp/modconfig-jKG9kf/vmhgfs-only/vmhgfs.mod.o
LD [M]  /tmp/modconfig-jKG9kf/vmhgfs-only/vmhgfs.ko
make[1]: Map '/usr/src/kernels/3.8.13-26.2.3.el6uek.x86_64' wordt verlaten
/usr/bin/make -C $PWD SRCROOT=$PWD/. \
MODULEBUILDDIR= postbuild
make[1]: Map '/tmp/modconfig-jKG9kf/vmhgfs-only' wordt binnengegaan
make[1]: 'postbuild' is bijgewerkt.
make[1]: Map '/tmp/modconfig-jKG9kf/vmhgfs-only' wordt verlaten
cp -f vmhgfs.ko ./../vmhgfs.o
make: Map '/tmp/modconfig-jKG9kf/vmhgfs-only' wordt verlaten

The vmxnet driver is no longer supported on kernels 3.3 and greater. Please
upgrade to a newer virtual NIC. (e.g., vmxnet3 or e1000e)

The vmblock enables dragging or copying files between host and guest in a
Fusion or Workstation virtual environment.  Do you wish to enable this feature?
[yes]

VMware automatic kernel modules enables automatic building and installation of
VMware kernel modules at boot that are not already present. This feature can be

enabled/disabled by re-running vmware-config-tools.pl.

Would you like to enable VMware automatic kernel modules?
[yes]

Thinprint provides driver-free printing. Do you wish to enable this feature?
[yes]

Disabling timer-based audio scheduling in pulseaudio.

Detected X server version 1.13.0

Distribution provided drivers for Xorg X server are used.

Skipping X configuration because X drivers are not included.

Creating a new initrd boot image for the kernel.
Starting Virtual Printing daemon:                                   done
Checking acpi hot plug                                  [  OK  ]
Starting VMware Tools services in the virtual machine:
Switching to guest configuration:                       [  OK  ]
VMware Automatic Kmods:                                 [  OK  ]
VM communication interface:                             [MISLUKT]
Guest filesystem driver:                                [  OK  ]
Mounting HGFS shares:                                   [  OK  ]
Blocking file system:                                   [  OK  ]
Guest operating system daemon:                          [  OK  ]
The configuration of VMware Tools 9.6.2 build-1688356 for Linux for this
running kernel completed successfully.

You must restart your X session before any mouse or graphics changes take
effect.

You can now run VMware Tools by invoking "/usr/bin/vmware-toolbox-cmd" from the
command line.

To enable advanced X features (e.g., guest resolution fit, drag and drop, and
file and text copy/paste), you will need to do one (or more) of the following:
1. Manually start /usr/bin/vmware-user
2. Log out and log back into your desktop session; and,
3. Restart your X session.

Enjoy,

--the VMware team

/sbin/restorecon:  Warning no default label for /tmp/vmware-block-restore0/tmp_file
[root@surabaya vmware-tools-distrib]#
Broadcast message from root@surabaya
(/dev/pts/0) at 7:11 ...

The system is going down for reboot NOW!
Connection to 192.168.178.49 closed by remote host.
Connection to 192.168.178.49 closed.
pdeneef@semarang:~#

Linux Samba Configuration

http://www.oracle-base.com/articles/linux/linux-samba-configuration.php

Installation

The Samba service is installed from a Yum repository using the following command.

# yum install samba

Turn on the Samba server and make sure it starts automatically on reboot.

# service smb start
# chkconfig smb on

Samba is configured by altering the contents of the “/etc/samba/smb.conf” and “/etc/samba/smbusers” files. Configuration changes have to be followed by a reload or a restart of the smb service.

 

Firewall

If you are using the Linux firewall, you need to open ports 139 and 445 specifically. The Samba documentation suggest opening 3 additional ports also. Assuming you are using a firewall setup file, as described here, you can include the following additions to the INPUT chain.

# Open ports for SAMBA.
iptables -A INPUT -p tcp --dport 135 -j ACCEPT
iptables -A INPUT -p tcp --dport 137 -j ACCEPT
iptables -A INPUT -p tcp --dport 138 -j ACCEPT
iptables -A INPUT -p tcp --dport 139 -j ACCEPT
iptables -A INPUT -p tcp --dport 445 -j ACCEPT

SELinux

Install SELinux tools

# yum provides /usr/sbin/semanage
# yum -y install policycoreutils-python

If you are using SELinux, you will need to consider the following points.

The SELinux booleans associated with the Samba service are displayed using the getsebool command.

# getsebool -a | grep samba
samba_create_home_dirs --> off
samba_domain_controller --> off
samba_enable_home_dirs --> off
samba_export_all_ro --> off
samba_export_all_rw --> off
samba_run_unconfined --> off
samba_share_fusefs --> off
samba_share_nfs --> off
sanlock_use_samba --> off
use_samba_home_dirs --> off
virt_use_samba --> off
#

The setsebool command is used to set a specific boolean value.

# setsebool use_samba_home_dirs on
# setsebool use_samba_home_dirs off

The samba_share_t context should be assigned to all content.

# semanage fcontext -a -t samba_share_t "/u01(/.*)?"
# restorecon -F -R -v /u01

You can check the current context setting on files and directories using the “ls -alZ” command.

More information on SELinux can be found here.

Create Network Shares for Group Collaboration

This section describes the steps necessary to create Samba shares suitable for group collaboration.

Create a group that will act as the owner of the shared files.

# groupadd developers

Create some users that are assigned to the “developers” group.

# useradd dev1 -G developers
# passwd dev1 # password set to dev1

# id dev1
uid=501(dev1) gid=504(dev1) groups=504(dev1),506(developers)
#

# useradd dev2 -G developers
# passwd dev2 # password set to dev2

# id dev2
uid=502(dev2) gid=505(dev2) groups=505(dev2),506(developers)
#

Set the Samba password for the users.

# smbpasswd -a dev1
New SMB password:
Retype new SMB password:
Added user dev1.
#

# smbpasswd -a dev2
New SMB password:
Retype new SMB password:
Added user dev2.
#

Create a directory to own the shared files, making sure its group is set correctly. The permissions are set to “g+rwx” (0770), since the group is the defining factor in accessing data in this directory.

# mkdir /developers_dir
# chgrp developers /developers_dir
# chmod g+s /developers_dir
# chmod -R 770 /developers_dir

Add the following share into the “/etc/samba/smb.conf” file. Notice the 0770 permissions again, so users don’t accidentally create files that can’t be amended by other members of the group.

 

Create Network Shares

Shares are created by editing the “/etc/samba/smb.conf” file. In RHEL5 and Fedora distributions you can use a GUI tool called system-config-samba, but this has been removed from RHEL6.

The “/etc/samba/smb.conf” file contains an example share definition towards the bottom of the file. The “;” characters are comments.

[benkel]
path = /media/benkel
force group = benkel
valid users = @benkel
create mask = 0775
force create mode = 660
write list = @benkel
browseable = yes
hosts allow 192.168.178.*

Mount from Mac OS X

cd /Users/userdir/
mkdir -p mountpoint
mount -t smbfs //smbuser:smbpass@smbhost/benkel /Users/userdir/mountpoint

Permanent Mount from Mac OS X

http://www.dforge.net/2012/08/07/create-a-permanent-smb-mount-in-osx/

Apache MySQL PHP Mac OS X

Edit httpd.conf to include php module

find / -name "httpd.conf" -print
/private/etc/apache2/httpd.conf

vi /private/etc/apache2/httpd.conf

LoadModule perl_module libexec/apache2/mod_perl.so
LoadModule php5_module libexec/apache2/libphp5.so

Find MySQl socket

find / -name "mysql.sock" -print

Prepare php.ini

cp /etc/php.ini.default /etc/php.ini

Edit /etc/php.ini


vi /etc/php.ini
; Default socket name for local MySQL connects. If empty, uses the built-in
; MySQL defaults.
; http://php.net/pdo_mysql.default-socket
pdo_mysql.default_socket=/private/tmp/mysql.sock

; Default socket name for local MySQL connects. If empty, uses the built-in
; MySQL defaults.
; http://php.net/mysql.default-socket
mysql.default_socket = /private/tmp/mysql.sock

Restart Apache

apachectl restart

Start MySQL deamon

Try /usr/local/mysql/bin/mysqld_safe

Example:

sudo /usr/local/mysql/bin/mysqld_safe
(Enter your password, if necessary)
(Press Control-Z)
shell> bg
(Press Control-D or enter "exit" to exit the shell)

You can also add these to your bash startup scripts:

export MYSQL_HOME=/usr/local/mysql
alias start_mysql='sudo $MYSQL_HOME/bin/mysqld_safe &'
alias stop_mysql='sudo $MYSQL_HOME/bin/mysqladmin shutdown'

How to Install Perl Modules on Mac OS X in 4 Easy Steps

http://triopter.com/archive/how-to-install-perl-modules-on-mac-os-x-in-4-easy-steps/

You see, for the past couple of years, I’ve been a bit frustrated because OS X does not come with a whole lot of Perl modules pre-installed, and for all I googled, I couldn’t find an “idiot’s” guide for moderately-savvy-but-not-expert users like myself to install modules and dependencies on demand.

The only instructions I could find point to Fink, which basically installs modules in a path that isn’t included in the Perl @INC variable, meaning you have to manually specify the full path to the modules in every script — which is not a lot of fun if you’re developing on OS X and deploying on Red Hat, for instance.

Moreover, Fink doesn’t seem to make every module available, and it’s not very easy to determine which Fink package you need to install if you need a particular module.

So, with a script that called on several apparently unavailable modules, and a deadline looming, I finally decided to suck it up and figure out how to use CPAN to install them:
1) Make sure you have the Apple Developer Tools (XCode) installed.

These are on one of your install discs, or available as a huge but free download from the Apple Developer Connection [free registration required] or the Mac App Store. I thought I had them, but apparently when we upgraded that computer to Tiger, they went missing.

If you don’t have this stuff installed, your installation will fail with errors about unavailable commands.
1.5) Install Command Line Tools (Recent XCode versions only)

(Thank you to Tom Marchioro for informing me about this step.)

Older versions of XCode installed the command line tools (which are required to properly install CPAN modules) by default, but apparently newer ones do not. To check whether you have the command line tools already installed, run the following from the Terminal:

$ which make

This command checks the system for the “make” tool. If it spits out something like /usr/bin/make you’re golden and can skip ahead to Step 2. If you just get a new prompt and no output, you’ll need to install the tools:

Launch XCode and bring up the Preferences panel.
Click on the Downloads tab
Click to install the Command Line Tools

If you like, you can run which make again to confirm that everything’s installed correctly.
2) Configure CPAN.

$ sudo perl -MCPAN -e shell

perl> o conf init

This will prompt you for some settings. You can accept the defaults for almost everything (just hit “return”). The two things you must fill in are the path to make (which should be /usr/bin/make or the value returned when you run which make from the command line) and your choice of CPAN mirrors (which you actually choose don’t really matter, but it won’t let you finish until you select at least one). If you use a proxy or a very restrictive firewall, you may have to configure those settings as well.

If you skip Step 2, you may get errors about make being unavailable.
3) Upgrade CPAN

$ sudo perl -MCPAN -e ‘install Bundle::CPAN’

Don’t forget the sudo, or it’ll fail with permissions errors, probably when doing something relatively unimportant like installing man files.

This will spend a long time downloading, testing, and compiling various files and dependencies. Bear with it. It will prompt you a few times about dependencies. You probably want to enter “yes”. I agreed to everything it asked me, and everything turned out fine. YMMV of course. If everything installs properly, it’ll give you an “OK” at the end.
4) Install your modules. For each module….

$ sudo perl -MCPAN -e ‘install Bundle::Name’

or

$ sudo perl -MCPAN -e ‘install Module::Name’

This will install the module and its dependencies. Nice, eh? Again, don’t forget the sudo.

The first time you run this after upgrading CPAN, it may prompt you to configure again (see Step 2). If you accept its offer to try to configure itself automatically, it may just run through everything without a problem.

There are a couple of potential pitfalls with specific modules (such as the LWP::UserAgent / HEAD issue), but most have workarounds, and I haven’t run into anything that wasn’t easily recoverable.

And that’s it!

Did you find this useful? Is there anything I missed?