How to run metatrader 4 in Ubuntu 12.04 with Linode server
2013-07-28
381 words
2 mins read
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
2. copy files from windows system to Ubuntu system.
3. Install gnome to my linode server.
4. Install vncserver
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
Change /home/ACOUNTNAMETORUNMT/.vnc/xstartup file as below
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:
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.
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="800x600"
GEOMETRY="1024x768"
#GEOMETRY="1280x1024"
# 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 80x24+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.
Authored By Jesse Lau
A freelancer living in New Zealand, engaged in website development and program trading. Ever won 1st ranking twice in the Dukascopy Strategy Contest. This article is licensed under a Creative Commons Attribution 4.0 International License.