You can easily do this. To learn how to install bitcoind on ubuntu, check the tutorial here: https://github.com/kyledrake/coinpunk/blob/master/docs/INSTALL.md#install-and-configure-bitcoind
Make sure you do sudo apt-get update && sudo apt-get upgrade
first!
It is also reccomended to run these commands:
sudo apt-get install git autoconf libtool ntp build-essential
and
sudo apt-get install unattended-upgrades
sudo dpkg-reconfigure -plow unattended-upgrades
You can then use http://jsonrpcphp.org/ (for php) to connect to the daemon and execute daemon commands.