How to run metatrader 4 in Ubuntu 12.04 with Linode server

Jul 28

I decided to run metatrader in my linode server because Windows VPS is very expensive.

After a few hours’ work, I succeeded.

Record here

1. Install wine on Ubuntu

sudo add-apt-repository ppa:ubuntu-wine/ppa
sudo apt-get update
sudo apt-get install wine

2. copy files from windows system to Ubuntu system.

Upload C:\windows\Fonts\*.* to /home/USERNAME/.wine/drive_c/windows/Fonts Upload C:\windows\system32\mfc*.* to /home/USERNAME/.wine/drive_c/windows/system32

3. Install gnome to my linode server.

sudo apt-get install x-window-system-core

sudo apt-get install gnome-core

4. Install vncserver

sudo apt-get install vnc4server

Then download a vnc clent application in windows system. I use UltraVNC Viewer

5. Make vncserver auto start with my linux server boot. Start gnome as well.

Use winscp to make a new file on /etc/init.d/vncserver

cp the following code to the file

#!/bin/sh -e
### BEGIN INIT INFO
# Provides:          vncserver
# Required-Start:    networking
# Default-Start:     3 4 5
# Default-Stop:      0 6
### END INIT INFO

PATH=”$PATH:/usr/X11R6/bin/”

# The Username:Group that will run VNC
export USER=”ACCOUNTNAMETORUNMT”
#${RUNAS}

# The display that VNC will use
DISPLAY=”1″

# Color depth (between 8 and 32)
DEPTH=”16″

# The Desktop geometry to use.
#GEOMETRY=”<WIDTH>x<HEIGHT>”
#GEOMETRY=”800×600″
GEOMETRY=”1024×768″
#GEOMETRY=”1280×1024″

# The name that the VNC Desktop will have.
NAME=”my-vnc-server”

OPTIONS=”-name ${NAME} -depth ${DEPTH} -geometry ${GEOMETRY} :${DISPLAY}”

. /lib/lsb/init-functions

case “$1″ in
start)
log_action_begin_msg “Starting vncserver for user ‘${USER}’ on localhost:${DISPLAY}”
su ${USER} -c “/usr/bin/vncserver ${OPTIONS}”
;;

stop)
log_action_begin_msg “Stoping vncserver for user ‘${USER}’ on localhost:${DISPLAY}”
su ${USER} -c “/usr/bin/vncserver -kill :${DISPLAY}”
;;

restart)
$0 stop
$0 start
;;
esac

exit 0

Change /home/ACOUNTNAMETORUNMT/.vnc/xstartup file as below

#!/bin/sh

# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
# x-terminal-emulator -geometry 80×24+10+10 -ls -title “$VNCDESKTOP Desktop” &
# x-window-manager &
gnome-session –session=gnome-classic &

 

6 Use UltraVNC Viewer to login the Ubuntu system. Use wine to run the metatrader setup.exe to install.

Meet “access denied” error. It’s because wine installed in root but the program run in Accountnametorunmt. Google wine wiki to find the solution:

sudo chown -R $USER:$USER .wine

OK! Metatrader can be run on cheap linode server now.

If you want to auto start metatrader to run Expert Advisor when the server reboot.

Just configure the app on startup in Gnome. That’s all.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word